Introduce variables for canny stuff instead of hardcoding

This commit is contained in:
2022-11-16 11:18:56 +01:00
parent d9628550d4
commit 8611a47b75
6 changed files with 21 additions and 9 deletions
+3 -3
View File
@@ -17,16 +17,16 @@ static double angle( Point pt1, Point pt2, Point pt0 )
return (dx1*dx2 + dy1*dy2)/sqrt((dx1*dx1 + dy1*dy1)*(dx2*dx2 + dy2*dy2) + 1e-10);
}
void Processing::processImage(Mat& inputPicture, int thresholdValue, int gaussKernelSize)
void Processing::processImage(Mat& inputPicture, int thresholdBinary, int gaussKernelSize, int thresholdCanny1, int thresholdCanny2, int apertureSizeCanny)
{
//Idea here is: Processing module consists of two methods:
// One (this) to do all kinds of stuff to the picture (grayscale conversion, threshold, gauss etc etc)
// And one (the other one) to segment the lines.
// No return value here as the input is passed by reference -> directly modified.
cvtColor(inputPicture, inputPicture, COLOR_BGR2GRAY);
threshold(inputPicture, inputPicture, thresholdValue, 255, THRESH_BINARY);
threshold(inputPicture, inputPicture, thresholdBinary, 255, THRESH_BINARY);
GaussianBlur(inputPicture, inputPicture, Size(gaussKernelSize, gaussKernelSize), 0);
Canny(inputPicture, inputPicture, 50, 100, 3);
Canny(inputPicture, inputPicture, thresholdCanny1, thresholdCanny2, apertureSizeCanny);
}
std::vector<Vec4i> Processing::calculateLineSegments(const Mat& inputPicture)
+1 -1
View File
@@ -19,7 +19,7 @@ public:
// End und Anfangspunkt analysieren und Winkel und Ausrichtung der Linie extrahieren (Abstand des untersten Punktes von der Mitte)
~Processing();
void processImage(Mat& inputPicture, int thresholdValue, int gaussKernelSize);
void processImage(Mat& inputPicture, int thresholdBinary, int gaussKernelSize, int thresholdCanny1, int thresholdCanny2, int apertureSizeCanny);
std::vector<Vec4i> calculateLineSegments(const Mat& inputPicture);
};