Projektarbeit Line Following Robot bei Prof. Chowanetz im WS22/23
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

spielwiese.cpp 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include <opencv2/core/utils/logger.hpp>
  2. #include <opencv2/opencv.hpp>
  3. #include <iostream>
  4. #include <input.h>
  5. #include <processing.h>
  6. #include <control_module.h>
  7. #include <interpreter.h>
  8. #include <intersection_handler.h>
  9. int main(void)
  10. {
  11. //Disable opencv logging messages
  12. cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_WARNING);
  13. const int thresholdBinary = 140;
  14. const int videoHeight = 720;
  15. const int videoWidth = 960;
  16. const int gaussKernelSize = 21;
  17. const int thresholdCanny1 = 50;
  18. const int thresholdCanny2 = 100;
  19. const int apertureSizeCanny = 3;
  20. Input input(videoHeight, videoWidth);
  21. Processing processing;
  22. namedWindow("Display window");
  23. while(true)
  24. {
  25. Mat image = input.readFile("Der\\Pfad\\zum\\Input\\Bilder\\Ordner\\auf\\deinem\\System");
  26. Mat processedImage = image;
  27. processing.processImage(processedImage, thresholdBinary, gaussKernelSize, thresholdCanny1, thresholdCanny2 ,apertureSizeCanny);
  28. std::vector<Vec4i> lines = processing.calculateLineSegments(processedImage);
  29. for( size_t i = 0; i < lines.size(); i++ )
  30. {
  31. line( image, Point(lines[i][0], lines[i][1]),
  32. Point( lines[i][2], lines[i][3]), (0,0,255), 1, 8 );
  33. }
  34. imshow("Display window", image);
  35. char c = (char)waitKey(1);
  36. }
  37. destroyWindow("Display window");
  38. input.freeWebcam();
  39. }