Remove unused canny parameters from processing and lfr, tried to get hughlinesp back in for reflection removal

This commit is contained in:
2022-12-08 11:20:51 +01:00
parent 0ea548ec8a
commit aec322031e
5 changed files with 39 additions and 31 deletions
+19 -5
View File
@@ -79,7 +79,7 @@ void Processing::filterReflections(FrameData& frameData)
return;
}
void Processing::processImage(Mat& inputPicture, int thresholdBinary, int gaussKernelSize, int thresholdCanny1, int thresholdCanny2, int apertureSizeCanny)
void Processing::processImage(Mat& inputPicture, int thresholdBinary, int gaussKernelSize)
{
//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)
@@ -88,16 +88,30 @@ void Processing::processImage(Mat& inputPicture, int thresholdBinary, int gaussK
cvtColor(inputPicture, inputPicture, COLOR_BGR2GRAY);
GaussianBlur(inputPicture, inputPicture, Size(gaussKernelSize, gaussKernelSize), 0);
threshold(inputPicture, inputPicture, thresholdBinary, 255, THRESH_BINARY);
//Perform a opening
//Perform an opening
Mat kernel(5,5, CV_8UC1,1);
morphologyEx(inputPicture, inputPicture, 2, kernel);
}
FrameData Processing::calculateLineSegments(const Mat& inputPicture, const cv::Rect& roi)
FrameData Processing::calculateLineSegments(Mat& inputPicture, const cv::Rect& roi)
{
FrameData data;
cv::findContours(inputPicture, data.contours, RETR_LIST, CHAIN_APPROX_SIMPLE);
Mat inputPictureRoi = inputPicture(roi);
cv::findContours(inputPictureRoi, data.contours, RETR_LIST, CHAIN_APPROX_SIMPLE);
vector<Vec4i> lines;
Canny(inputPicture, inputPicture, 50, 100, 3);
HoughLinesP(inputPicture, lines, 1, CV_PI/180, 100, 30, 50);
//Draw lines
inputPicture = Mat::zeros(inputPicture.size().height, inputPicture.size().width, CV_8UC1);
for( size_t i = 0; i < lines.size(); i++ )
{
line( inputPicture, Point(lines[i][0], lines[i][1]), Point(lines[i][2], lines[i][3]), Scalar(255,255,255), 3, 8 );
}
//Delete the areas that are too small
auto iterator = data.contours.begin();
+2 -2
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 thresholdBinary, int gaussKernelSize, int thresholdCanny1, int thresholdCanny2, int apertureSizeCanny);
void processImage(Mat& inputPicture, int thresholdBinary, int gaussKernelSize);
void filterReflections(FrameData& frameData);
FrameData calculateLineSegments(const Mat& inputPicture, const cv::Rect& roi);
FrameData calculateLineSegments(Mat& inputPicture, const cv::Rect& roi);
};