12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #include "lfr.h"
-
- const int threshold_binary = 110;
-
- LFR::LFR(int video_height, int video_width, int threshold_binary)
- : iAmLooping(false), input(video_height, video_width), processing(), controlModule(), interpreter(), intersectionHandler()
- {
- this->iAmLooping = false;
- this->threshold_binary = threshold_binary;
- }
-
- LFR::~LFR()
- {
- if(iAmLooping)
- {
- this->endLoop();
- }
- }
-
- void LFR::loop()
- {
- namedWindow("Display window");
- while(iAmLooping)
- {
- Mat image = input.readWebcam();
- processing.calculate_binaray(image, this->threshold_binary);
- std::vector<LFRLine> lines = processing.calculate_line_segments(image);
- imshow("Display window", image);
- char c = (char)waitKey(1);
- }
- destroyWindow("Display window");
- input.freeWebcam();
- }
-
- void LFR::startLoop()
- {
- iAmLooping = true;
- this->loopThread=thread(&LFR::loop, this);
- }
-
- void LFR::endLoop()
- {
- iAmLooping = false;
- this->loopThread.join();
- return;
- }
|