fine tuning with preparation for migration to bounding boxes instead of contours

This commit is contained in:
Harrison Deng 2018-05-07 17:53:22 -05:00
parent c8bcbe21e8
commit c2b817d200
4 changed files with 14 additions and 8 deletions

View File

@ -14,6 +14,8 @@ void ContourAnalyzer::analyze() {
if (*lastKey == 99) { if (*lastKey == 99) {
cannyRec = !cannyRec; cannyRec = !cannyRec;
} else if (*lastKey == 118) {
drawContours = !drawContours;
} }
if (cannyRec) { if (cannyRec) {
@ -60,6 +62,10 @@ void ContourAnalyzer::analyze() {
} }
} }
if (drawContours) {
drawContoursOntoMat(prunedContours, *(ui->originalFrame()));
}
} }
void ContourAnalyzer::drawContoursOntoMat(std::vector<std::vector<cv::Point>> &contours, cv::Mat &frame) { void ContourAnalyzer::drawContoursOntoMat(std::vector<std::vector<cv::Point>> &contours, cv::Mat &frame) {

View File

@ -14,7 +14,7 @@
class ContourAnalyzer: public UIListener { class ContourAnalyzer: public UIListener {
int *lastKey; int *lastKey;
bool cannyRec = false; bool cannyRec = false, drawContours = false;
UI *ui; UI *ui;
std::vector<std::vector<cv::Point>> contours; std::vector<std::vector<cv::Point>> contours;
std::vector<std::vector<cv::Point>> inconsistentContours; std::vector<std::vector<cv::Point>> inconsistentContours;
@ -23,12 +23,12 @@ class ContourAnalyzer: public UIListener {
std::vector<cv::Rect> bounds; std::vector<cv::Rect> bounds;
public: public:
int binLower = 60; int binLower = 52;
int cannyLower = 35; int cannyLower = 57;
int cannyUpper = 105; int cannyUpper = 3*cannyLower;
int epsilon = 48; int epsilon = 53;
ContourAnalyzer(UI* ui, int *lastKey); ContourAnalyzer(UI* ui, int *lastKey);
virtual ~ContourAnalyzer(); virtual ~ContourAnalyzer();

View File

@ -59,8 +59,8 @@ void UI::setOriginalFrame(cv::Mat frame) {
frames[0] = frame; frames[0] = frame;
} }
cv::Mat UI::getOriginalFrame() const { cv::Mat* UI::originalFrame() {
return frames[0]; return &frames[0];
} }
UI::~UI() { UI::~UI() {

View File

@ -30,7 +30,7 @@ public:
cv::Mat* currentFrame(int offset = 0); cv::Mat* currentFrame(int offset = 0);
void setOriginalFrame(cv::Mat frame); void setOriginalFrame(cv::Mat frame);
cv::Mat getOriginalFrame() const; cv::Mat* originalFrame();
virtual ~UI(); virtual ~UI();
}; };