diff --git a/lfr.cpp b/lfr.cpp index 654fdf1..75a7f78 100644 --- a/lfr.cpp +++ b/lfr.cpp @@ -1,29 +1,45 @@ -#include -#include -#include -#include -#include -#include -#include - -using namespace cv; - +#include "lfr.h" const int threshold_binary = 110; +LFR::LFR() : iAmLooping(false), input(), processing(), controlModule(), interpreter(), intersectionHandler() +{ + +} + +LFR::~LFR() +{ + +} + +void LFR::loop() +{ + //Give it 10 loops while async processing is not supported. + //while(iAmLooping) + for(int i = 0; i < 3; i++) + { + Mat image = input.readWebcam(); + processing.calculate_binaray(image, threshold_binary); + imshow("Display window", image); + waitKey(0); + } + iAmLooping = false; +} + +void LFR::startLoop() +{ + this->loop(); +} + +void LFR::endLoop() +{ + std::cout<<"The loop has been started. You may not dare to tell it to stop."; +} + + int main(void) { - //Set up - Input input; - Processing processing; - ControlModule controleModule; - Interpreter interpreter; - IntersectionHandler intersectionHandler; - //Mat image1 = input.readFile("C:\\Line-Following-Robot\\Test_data\\*.jpeg"); - Mat image1 = input.readWebcam(); - - processing.calculate_binaray(image1, threshold_binary); - imshow("Display window", image1); - waitKey(0); + LFR lfr; + lfr.startLoop(); } \ No newline at end of file diff --git a/lfr.h b/lfr.h new file mode 100644 index 0000000..69483fa --- /dev/null +++ b/lfr.h @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#include +#include +#include + +using namespace cv; + +class LFR +{ + Input input; + Processing processing; + ControlModule controlModule; + Interpreter interpreter; + IntersectionHandler intersectionHandler; + bool iAmLooping; + void loop(); + +public: + + LFR(); + ~LFR(); + + void startLoop(); + void endLoop(); + + +}; \ No newline at end of file