Erster Entwurft für Controlling
This commit is contained in:
@@ -11,15 +11,6 @@ Processing::~Processing()
|
||||
{
|
||||
}
|
||||
|
||||
static double angle( Point pt1, Point pt2, Point pt0 )
|
||||
{
|
||||
double dx1 = pt1.x - pt0.x;
|
||||
double dy1 = pt1.y - pt0.y;
|
||||
double dx2 = pt2.x - pt0.x;
|
||||
double dy2 = pt2.y - pt0.y;
|
||||
return (dx1*dx2 + dy1*dy2)/sqrt((dx1*dx1 + dy1*dy1)*(dx2*dx2 + dy2*dy2) + 1e-10);
|
||||
}
|
||||
|
||||
void Processing::filterReflections(FrameData& frameData)
|
||||
{
|
||||
//Try to filter reflections from the frame data.
|
||||
@@ -86,12 +77,13 @@ bool Processing::checkIntersection(const std::vector<std::vector<Point>>& lines,
|
||||
return true;
|
||||
}
|
||||
|
||||
int Processing::calcAngles(FrameData &data, int imageColums, int imageRows, bool turnLeft)
|
||||
void Processing::calcAngles(FrameData &data, int imageColums, int imageRows, bool turnLeft)
|
||||
{
|
||||
int angle = 0;
|
||||
|
||||
if(data.contours.size() > 0)
|
||||
{
|
||||
int index;
|
||||
{
|
||||
int angle = 0;
|
||||
int index;
|
||||
if(turnLeft){
|
||||
// get the most left/right contour
|
||||
int leftmostEdge = imageColums;
|
||||
@@ -141,9 +133,12 @@ int Processing::calcAngles(FrameData &data, int imageColums, int imageRows, bool
|
||||
// calculate angle
|
||||
int deltaX = abs(xleftButtom - xleftTop);
|
||||
int deltaY = yTop;
|
||||
angle = VectorOfLines::calcAngle(deltaX, deltaY);
|
||||
angle = Calcs::calcAngle(deltaX, deltaY);
|
||||
|
||||
//Write to Data
|
||||
data.angle = angle;
|
||||
data.index = index;
|
||||
}
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,5 +24,5 @@ public:
|
||||
void processImage(Mat& inputPicture, int thresholdBinary, int gaussKernelSize);
|
||||
void filterReflections(FrameData& frameData);
|
||||
FrameData calculateLineSegments(Mat& inputPicture, const cv::Rect& roi);
|
||||
int calcAngles(FrameData &data, int imageColums, int imageRows, bool turnLeft);
|
||||
void calcAngles(FrameData &data, int imageColums, int imageRows, bool turnLeft);
|
||||
};
|
||||
Reference in New Issue
Block a user