diff --git a/Spielwiese/spielwiese.cpp b/Spielwiese/spielwiese.cpp index dbd4843..5b27b5b 100644 --- a/Spielwiese/spielwiese.cpp +++ b/Spielwiese/spielwiese.cpp @@ -9,28 +9,15 @@ #include #include -int main(void) +void sweep_em_all(int thresholdBinary, int videoHeight, int videoWidth, int gaussKernelSize, int thresholdCanny1, int thresholdCanny2, int apertureSizeCanny) { - //Disable opencv logging messages - cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_WARNING); - - const int thresholdBinary = 140; - const int videoHeight = 720; - const int videoWidth = 960; - const int gaussKernelSize = 21; - const int thresholdCanny1 = 50; - const int thresholdCanny2 = 100; - const int apertureSizeCanny = 3; - - - Input input(videoHeight, videoWidth); Processing processing; namedWindow("Display window"); while(true) { - Mat image = input.readFile("Der\\Pfad\\zum\\Input\\Bilder\\Ordner\\auf\\deinem\\System"); + Mat image = input.readFile("C:\\Users\\User\\Desktop\\Studium\\02_Master_MSY\\2. Semester Winter 22 23\\Projekt\\Line-Following-Robot\\Test_data"); Mat processedImage = image; processing.processImage(processedImage, thresholdBinary, gaussKernelSize, thresholdCanny1, thresholdCanny2 ,apertureSizeCanny); std::vector lines = processing.calculateLineSegments(processedImage); @@ -43,5 +30,40 @@ int main(void) char c = (char)waitKey(1); } destroyWindow("Display window"); - input.freeWebcam(); +} + +void in_depth_processing_chain(int thresholdBinary, int videoHeight, int videoWidth, int gaussKernelSize, int thresholdCanny1, int thresholdCanny2, int apertureSizeCanny) +{ + std::string outputFolder = "C:\\Users\\User\\Desktop\\temp"; + Input input(videoHeight, videoWidth); + + Mat image = input.readFile("C:\\Users\\User\\Desktop\\Studium\\02_Master_MSY\\2. Semester Winter 22 23\\Projekt\\Line-Following-Robot\\Test_data"); + imwrite(outputFolder + "\\01_input.jpg", image); + cvtColor(image, image, COLOR_BGR2GRAY); + imwrite(outputFolder + "\\02_color_convert.jpg", image); + GaussianBlur(image, image, Size(gaussKernelSize, gaussKernelSize), 0); + imwrite(outputFolder + "\\03_gauss.jpg", image); + threshold(image, image, thresholdBinary, 255, THRESH_BINARY); + imwrite(outputFolder + "\\04_threshold.jpg", image); + Canny(image, image, thresholdCanny1, thresholdCanny2, apertureSizeCanny); + imwrite(outputFolder + "\\05_canny.jpg", image); + +} + + +int main(void) +{ + //Disable opencv logging messages + cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_WARNING); + + const int thresholdBinary = 140; + const int videoHeight = 720; + const int videoWidth = 960; + const int gaussKernelSize = 11; + const int thresholdCanny1 = 50; + const int thresholdCanny2 = 100; + const int apertureSizeCanny = 3; + + //sweep_em_all(thresholdBinary, videoHeight, videoWidth, gaussKernelSize, thresholdCanny1, thresholdCanny2, apertureSizeCanny); + in_depth_processing_chain(thresholdBinary, videoHeight, videoWidth, gaussKernelSize, thresholdCanny1, thresholdCanny2, apertureSizeCanny); } \ No newline at end of file