diff --git a/src/Rectangle/Detection/ContourAnalyzer.cpp b/src/Rectangle/Detection/ContourAnalyzer.cpp index d71b894..f020499 100755 --- a/src/Rectangle/Detection/ContourAnalyzer.cpp +++ b/src/Rectangle/Detection/ContourAnalyzer.cpp @@ -14,6 +14,8 @@ void ContourAnalyzer::analyze() { if (*lastKey == 99) { cannyRec = !cannyRec; + } else if (*lastKey == 118) { + drawContours = !drawContours; } if (cannyRec) { @@ -60,6 +62,10 @@ void ContourAnalyzer::analyze() { } } + + if (drawContours) { + drawContoursOntoMat(prunedContours, *(ui->originalFrame())); + } } void ContourAnalyzer::drawContoursOntoMat(std::vector> &contours, cv::Mat &frame) { diff --git a/src/Rectangle/Detection/ContourAnalyzer.h b/src/Rectangle/Detection/ContourAnalyzer.h index 1f85d76..77c62d3 100755 --- a/src/Rectangle/Detection/ContourAnalyzer.h +++ b/src/Rectangle/Detection/ContourAnalyzer.h @@ -14,7 +14,7 @@ class ContourAnalyzer: public UIListener { int *lastKey; - bool cannyRec = false; + bool cannyRec = false, drawContours = false; UI *ui; std::vector> contours; std::vector> inconsistentContours; @@ -23,12 +23,12 @@ class ContourAnalyzer: public UIListener { std::vector bounds; public: - int binLower = 60; + int binLower = 52; - int cannyLower = 35; - int cannyUpper = 105; + int cannyLower = 57; + int cannyUpper = 3*cannyLower; - int epsilon = 48; + int epsilon = 53; ContourAnalyzer(UI* ui, int *lastKey); virtual ~ContourAnalyzer(); diff --git a/src/UI.cpp b/src/UI.cpp index 196398b..9196f6f 100755 --- a/src/UI.cpp +++ b/src/UI.cpp @@ -59,8 +59,8 @@ void UI::setOriginalFrame(cv::Mat frame) { frames[0] = frame; } -cv::Mat UI::getOriginalFrame() const { - return frames[0]; +cv::Mat* UI::originalFrame() { + return &frames[0]; } UI::~UI() { diff --git a/src/UI.h b/src/UI.h index 17a7be7..ec85265 100755 --- a/src/UI.h +++ b/src/UI.h @@ -30,7 +30,7 @@ public: cv::Mat* currentFrame(int offset = 0); void setOriginalFrame(cv::Mat frame); - cv::Mat getOriginalFrame() const; + cv::Mat* originalFrame(); virtual ~UI(); };