#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 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; }