Cleaned up snake/camel case inconsistencies, added parameter for gauss kernel size
This commit is contained in:
parent
d00cd2945b
commit
0d619a22f8
@ -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()
|
||||
|
@ -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);
|
||||
|
@ -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<LFRLine> Processing::calculate_line_segments(const Mat& inputPicture)
|
||||
std::vector<LFRLine> Processing::calculateLineSegments(const Mat& inputPicture)
|
||||
{
|
||||
return std::vector<LFRLine>();
|
||||
}
|
||||
|
@ -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<LFRLine> calculate_line_segments(const Mat& inputPicture);
|
||||
std::vector<LFRLine> calculateLineSegments(const Mat& inputPicture);
|
||||
};
|
@ -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;
|
||||
|
12
lfr.cpp
12
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<LFRLine> lines = processing.calculate_line_segments(image);
|
||||
processing.processImage(image, this->thresholdBinary, this->gaussKernelSize);
|
||||
std::vector<LFRLine> lines = processing.calculateLineSegments(image);
|
||||
imshow("Display window", image);
|
||||
char c = (char)waitKey(1);
|
||||
}
|
||||
|
5
lfr.h
5
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user