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.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 VectorOfLines{
  40. private:
  41. public:
  42. Point startPoint;
  43. float gradient;
  44. float zeroPoint;
  45. VectorOfLines();
  46. ~VectorOfLines();
  47. static double calcGradient(Point x, Point y);
  48. float calcZeroPoint(cv::Point x, float m);
  49. static double calcDistance(Point p0, Point p1);
  50. vector<Vec4i> findMiddleLine(vector<Vec4i> &lines);
  51. };