split lfr in cpp and h file
This commit is contained in:
parent
cbb147c6fa
commit
d952629b39
60
lfr.cpp
60
lfr.cpp
@ -1,29 +1,45 @@
|
|||||||
#include <iostream>
|
#include "lfr.h"
|
||||||
#include <opencv2/opencv.hpp>
|
|
||||||
#include <input.h>
|
|
||||||
#include <processing.h>
|
|
||||||
#include <control_module.h>
|
|
||||||
#include <interpreter.h>
|
|
||||||
#include <intersection_handler.h>
|
|
||||||
|
|
||||||
using namespace cv;
|
|
||||||
|
|
||||||
const int threshold_binary = 110;
|
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)
|
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.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();
|
||||||
}
|
}
|
30
lfr.h
Normal file
30
lfr.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <opencv2/opencv.hpp>
|
||||||
|
#include <input.h>
|
||||||
|
#include <processing.h>
|
||||||
|
#include <control_module.h>
|
||||||
|
#include <interpreter.h>
|
||||||
|
#include <intersection_handler.h>
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user