|
|
|
|
|
|
|
|
#include "lfr.h" |
|
|
#include "lfr.h" |
|
|
|
|
|
|
|
|
const int threshold_binary = 110; |
|
|
const int threshold_binary = 110; |
|
|
|
|
|
|
|
|
LFR::LFR() : iAmLooping(false), input(), processing(), controlModule(), interpreter(), intersectionHandler() |
|
|
LFR::LFR() : iAmLooping(false), input(), processing(), controlModule(), interpreter(), intersectionHandler() |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
LFR::~LFR() |
|
|
LFR::~LFR() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LFR::loop() |
|
|
void LFR::loop() |
|
|
{ |
|
|
{ |
|
|
//while(iAmLooping) |
|
|
|
|
|
for(int i = 0; i < 3; i++) |
|
|
|
|
|
|
|
|
namedWindow("Display window"); |
|
|
|
|
|
while(iAmLooping) |
|
|
{ |
|
|
{ |
|
|
Mat image = input.readWebcam(); |
|
|
Mat image = input.readWebcam(); |
|
|
processing.calculate_binaray(image, threshold_binary); |
|
|
processing.calculate_binaray(image, threshold_binary); |
|
|
imshow("Display window", image); |
|
|
imshow("Display window", image); |
|
|
waitKey(0); |
|
|
|
|
|
|
|
|
char c = (char)waitKey(1); |
|
|
} |
|
|
} |
|
|
|
|
|
destroyWindow("Display window"); |
|
|
|
|
|
input.freeWebcam(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
std::future<void> LFR::startLoop() |
|
|
|
|
|
|
|
|
void LFR::startLoop() |
|
|
{ |
|
|
{ |
|
|
iAmLooping = true; |
|
|
iAmLooping = true; |
|
|
std::cout<<"Loop start\n"; |
|
|
|
|
|
return std::async(&LFR::loop, this); |
|
|
|
|
|
|
|
|
this->loopThread=thread(&LFR::loop, this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void LFR::endLoop() |
|
|
void LFR::endLoop() |
|
|
{ |
|
|
{ |
|
|
iAmLooping = false; |
|
|
iAmLooping = false; |
|
|
std::cout<<"loop ende\n"; |
|
|
|
|
|
|
|
|
this->loopThread.join(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |