Projektarbeit Line Following Robot bei Prof. Chowanetz im WS22/23
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.h 1.3KB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #include <opencv2/opencv.hpp>
  3. using namespace cv;
  4. using namespace std;
  5. class LFRPoint
  6. {
  7. private:
  8. /* data */
  9. public:
  10. double x, y;
  11. LFRPoint(/* args */);
  12. LFRPoint(double x, double y);
  13. ~LFRPoint();
  14. LFRPoint operator-(const LFRPoint& pt){return LFRPoint(x-pt.x, y-pt.y);}
  15. LFRPoint operator+(const LFRPoint& pt){return LFRPoint(x+pt.x, y+pt.y);}
  16. };
  17. class LFRVector : public LFRPoint
  18. {
  19. private:
  20. /* data */
  21. public:
  22. LFRVector(/* args */);
  23. LFRVector(double x, double y);
  24. LFRVector(const LFRPoint& pt);
  25. ~LFRVector();
  26. };
  27. class LFRLine
  28. {
  29. private:
  30. /* data */
  31. public:
  32. LFRPoint start;
  33. LFRVector dir;
  34. LFRLine(/* args */);
  35. LFRLine(LFRPoint start, LFRVector dir);
  36. LFRLine(LFRPoint start, LFRPoint end);
  37. ~LFRLine();
  38. };
  39. class Calcs{
  40. private:
  41. public:
  42. static int calcAngle(int deltaX, int deltaY);
  43. };
  44. class FrameData
  45. {
  46. public:
  47. std::vector<std::vector<cv::Point>> contours;
  48. std::vector<cv::Rect> boundingBoxes;
  49. std::vector<cv::Point> leftEdges;
  50. std::vector<cv::Point> middlePoints;
  51. int angle; //Angle of the contour the robot has to follow to
  52. int index; //Index of the contour the robot has to follow to
  53. FrameData(): contours(), boundingBoxes(), leftEdges(), middlePoints() {}
  54. };