Browse Source

Different methods for spielwiese

pull/1/head
Tim Zeuner 2 years ago
parent
commit
6645e25fb8
1 changed files with 38 additions and 16 deletions
  1. 38
    16
      Spielwiese/spielwiese.cpp

+ 38
- 16
Spielwiese/spielwiese.cpp View File

#include <interpreter.h> #include <interpreter.h>
#include <intersection_handler.h> #include <intersection_handler.h>


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); Input input(videoHeight, videoWidth);
Processing processing; Processing processing;


namedWindow("Display window"); namedWindow("Display window");
while(true) 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; Mat processedImage = image;
processing.processImage(processedImage, thresholdBinary, gaussKernelSize, thresholdCanny1, thresholdCanny2 ,apertureSizeCanny); processing.processImage(processedImage, thresholdBinary, gaussKernelSize, thresholdCanny1, thresholdCanny2 ,apertureSizeCanny);
std::vector<Vec4i> lines = processing.calculateLineSegments(processedImage); std::vector<Vec4i> lines = processing.calculateLineSegments(processedImage);
char c = (char)waitKey(1); char c = (char)waitKey(1);
} }
destroyWindow("Display window"); 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);
} }

Loading…
Cancel
Save