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.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 = 240;
  15. const int videoWidth = 320;
  16. const int gaussKernelSize = 21;
  17. Input input(videoHeight, videoWidth);
  18. Processing processing;
  19. namedWindow("Display window");
  20. while(true)
  21. {
  22. Mat image = input.readFile("Der//Pfad//zum//Input//Bilder//Ordner//auf//deinem//System");
  23. Mat processedImage = image;
  24. processing.processImage(processedImage, thresholdBinary, gaussKernelSize);
  25. std::vector<Vec4i> lines = processing.calculateLineSegments(processedImage);
  26. for( size_t i = 0; i < lines.size(); i++ )
  27. {
  28. line( image, Point(lines[i][0], lines[i][1]),
  29. Point( lines[i][2], lines[i][3]), (0,0,255), 1, 8 );
  30. }
  31. imshow("Display window", image);
  32. char c = (char)waitKey(1);
  33. }
  34. destroyWindow("Display window");
  35. input.freeWebcam();
  36. }