diff --git a/Input/input.cpp b/Input/input.cpp index a85139b..728583a 100644 --- a/Input/input.cpp +++ b/Input/input.cpp @@ -1,9 +1,9 @@ #include "input.h" -Input::Input(int video_height, int video_width) : cap(0), video_height(video_height), video_width(video_width) +Input::Input(int videoHeight, int videoWidth) : cap(0), videoHeight(videoHeight), videoWidth(videoWidth) { - this->cap.set(CAP_PROP_FRAME_HEIGHT, video_height); - this->cap.set(CAP_PROP_FRAME_WIDTH, video_width); + this->cap.set(CAP_PROP_FRAME_HEIGHT, videoHeight); + this->cap.set(CAP_PROP_FRAME_WIDTH, videoWidth); } Input::~Input() diff --git a/Input/input.h b/Input/input.h index 1fc1e32..c4accac 100644 --- a/Input/input.h +++ b/Input/input.h @@ -17,9 +17,9 @@ private: VideoCapture cap; public: - int video_height; - int video_width; - Input(int video_height, int video_width); + int videoHeight; + int videoWidth; + Input(int videoHeight, int videoWidth); Input() = delete; ~Input(); Mat readFile(String filePath); diff --git a/Processing/processing.cpp b/Processing/processing.cpp index d130cb3..9d57e4a 100644 --- a/Processing/processing.cpp +++ b/Processing/processing.cpp @@ -8,15 +8,17 @@ Processing::~Processing() { } -Mat Processing::calculate_binaray(Mat& inputPicture, int thresholdValue) +void Processing::processImage(Mat& inputPicture, int thresholdValue, int gaussKernelSize) { - //Mat &outputPicture; + //Idea here is: Processing module consists of two methods: + // One (this) to do all kinds of stuff to the picture (grayscale conversion, threshold, gauss etc etc) + // And one (the other one) to segment the lines. + // No return value here as the input is passed by reference -> directly modified. cvtColor(inputPicture, inputPicture, COLOR_BGR2GRAY); threshold(inputPicture, inputPicture, thresholdValue, 255, THRESH_BINARY); - return inputPicture; } -std::vector Processing::calculate_line_segments(const Mat& inputPicture) +std::vector Processing::calculateLineSegments(const Mat& inputPicture) { return std::vector(); } diff --git a/Processing/processing.h b/Processing/processing.h index c04f2a2..48aadf6 100644 --- a/Processing/processing.h +++ b/Processing/processing.h @@ -17,7 +17,7 @@ public: // End und Anfangspunkt analysieren und Winkel und Ausrichtung der Linie extrahieren (Abstand des untersten Punktes von der Mitte) ~Processing(); - Mat calculate_binaray(Mat& inputPicture, int thresholdValue); + void processImage(Mat& inputPicture, int thresholdValue, int gaussKernelSize); - std::vector calculate_line_segments(const Mat& inputPicture); + std::vector calculateLineSegments(const Mat& inputPicture); }; \ No newline at end of file diff --git a/autonomous_mode_main.cpp b/autonomous_mode_main.cpp index 19139d0..7f9834f 100644 --- a/autonomous_mode_main.cpp +++ b/autonomous_mode_main.cpp @@ -6,11 +6,12 @@ int main(void) //Disable opencv logging messages cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_WARNING); - const int threshold_binary = 110; - const int video_height = 240; - const int video_width = 320; + const int thresholdBinary = 110; + const int videoHeight = 240; + const int videoWidth = 320; + const int gaussKernelSize = 5; - LFR lfr(video_height, video_width, threshold_binary); + LFR lfr(videoHeight, videoWidth, thresholdBinary, gaussKernelSize); lfr.startLoop(); //To end the video stream, write any char in the console. char a; diff --git a/lfr.cpp b/lfr.cpp index b53ad93..0161fcb 100644 --- a/lfr.cpp +++ b/lfr.cpp @@ -1,12 +1,12 @@ #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() +LFR::LFR(int videoHeight, int videoWidth, int thresholdBinary, int gaussKernelSize) + : iAmLooping(false), input(videoHeight, videoWidth), processing(), controlModule(), interpreter(), intersectionHandler() { this->iAmLooping = false; - this->threshold_binary = threshold_binary; + this->thresholdBinary = thresholdBinary; + this->gaussKernelSize = gaussKernelSize; } LFR::~LFR() @@ -23,8 +23,8 @@ void LFR::loop() while(iAmLooping) { Mat image = input.readWebcam(); - processing.calculate_binaray(image, this->threshold_binary); - std::vector lines = processing.calculate_line_segments(image); + processing.processImage(image, this->thresholdBinary, this->gaussKernelSize); + std::vector lines = processing.calculateLineSegments(image); imshow("Display window", image); char c = (char)waitKey(1); } diff --git a/lfr.h b/lfr.h index 7d7d432..5daf4ca 100644 --- a/lfr.h +++ b/lfr.h @@ -25,12 +25,13 @@ class LFR volatile bool iAmLooping; void loop(); thread loopThread; - int threshold_binary; + int thresholdBinary; + int gaussKernelSize; public: LFR() = delete; - LFR(int video_height, int video_width, int threshold_binary); + LFR(int videoHeight, int videoWidth, int thresholdBinary, int gaussKernelSize); ~LFR(); void startLoop();