2022-11-10 17:07:39 +01:00
|
|
|
#pragma once
|
|
|
|
|
2022-11-14 11:37:38 +01:00
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
|
|
|
|
using namespace cv;
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
2022-11-10 16:45:34 +01:00
|
|
|
class LFRPoint
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
/* data */
|
|
|
|
public:
|
|
|
|
double x, y;
|
|
|
|
LFRPoint(/* args */);
|
|
|
|
LFRPoint(double x, double y);
|
|
|
|
~LFRPoint();
|
|
|
|
|
|
|
|
LFRPoint operator-(const LFRPoint& pt){return LFRPoint(x-pt.x, y-pt.y);}
|
|
|
|
LFRPoint operator+(const LFRPoint& pt){return LFRPoint(x+pt.x, y+pt.y);}
|
|
|
|
};
|
|
|
|
|
|
|
|
class LFRVector : public LFRPoint
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
/* data */
|
|
|
|
public:
|
|
|
|
LFRVector(/* args */);
|
|
|
|
LFRVector(double x, double y);
|
|
|
|
LFRVector(const LFRPoint& pt);
|
|
|
|
~LFRVector();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class LFRLine
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
/* data */
|
|
|
|
|
|
|
|
public:
|
|
|
|
LFRPoint start;
|
|
|
|
LFRVector dir;
|
|
|
|
|
|
|
|
LFRLine(/* args */);
|
|
|
|
LFRLine(LFRPoint start, LFRVector dir);
|
|
|
|
LFRLine(LFRPoint start, LFRPoint end);
|
|
|
|
~LFRLine();
|
2022-11-14 11:37:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class VectorOfLines{
|
|
|
|
private:
|
|
|
|
public:
|
2022-11-14 17:31:01 +01:00
|
|
|
Point startPoint;
|
|
|
|
float gradient;
|
|
|
|
float zeroPoint;
|
2022-11-14 11:37:38 +01:00
|
|
|
VectorOfLines();
|
|
|
|
~VectorOfLines();
|
2022-11-15 17:33:20 +01:00
|
|
|
static double calcGradient(Point x, Point y);
|
2022-11-14 11:37:38 +01:00
|
|
|
float calcZeroPoint(cv::Point x, float m);
|
2022-11-15 17:33:20 +01:00
|
|
|
static double calcDistance(Point p0, Point p1);
|
|
|
|
vector<Vec4i> findMiddleLine(vector<Vec4i> &lines);
|
2022-11-14 17:31:01 +01:00
|
|
|
|
2022-11-10 16:45:34 +01:00
|
|
|
};
|