42 lines
756 B
C++
42 lines
756 B
C++
#include "lfr.h"
|
|
|
|
const int threshold_binary = 110;
|
|
|
|
LFR::LFR() : iAmLooping(false), input(), processing(), controlModule(), interpreter(), intersectionHandler()
|
|
{
|
|
}
|
|
|
|
LFR::~LFR()
|
|
{
|
|
if(iAmLooping)
|
|
{
|
|
this->endLoop();
|
|
}
|
|
}
|
|
|
|
void LFR::loop()
|
|
{
|
|
namedWindow("Display window");
|
|
while(iAmLooping)
|
|
{
|
|
Mat image = input.readWebcam();
|
|
processing.calculate_binaray(image, threshold_binary);
|
|
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;
|
|
} |