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.

lfr.cpp 717B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "lfr.h"
  2. const int threshold_binary = 110;
  3. LFR::LFR() : iAmLooping(false), input(), processing(), controlModule(), interpreter(), intersectionHandler()
  4. {
  5. }
  6. LFR::~LFR()
  7. {
  8. if(iAmLooping)
  9. {
  10. this->endLoop();
  11. }
  12. }
  13. void LFR::loop()
  14. {
  15. //while(iAmLooping)
  16. for(int i = 0; i < 3; i++)
  17. {
  18. Mat image = input.readWebcam();
  19. processing.calculate_binaray(image, threshold_binary);
  20. imshow("Display window", image);
  21. waitKey(0);
  22. }
  23. }
  24. std::future<void> LFR::startLoop()
  25. {
  26. iAmLooping = true;
  27. std::cout<<"Loop start\n";
  28. return std::async(&LFR::loop, this);
  29. }
  30. void LFR::endLoop()
  31. {
  32. iAmLooping = false;
  33. std::cout<<"loop ende\n";
  34. return;
  35. }