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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 float calcGradient(Point x, Point y);
  48. float calcZeroPoint(cv::Point x, float m);
  49. };