rectanglecv/src/Rectangle/Detection/ContourAnalyzer.h

47 lines
1.2 KiB
C++
Executable File

/*
* ContourAnalyzer.h
*
* Created on: Apr 22, 2018
* Author: Yunyang
*/
#ifndef RECTANGLE_DETECTION_CONTOURANALYZER_H_
#define RECTANGLE_DETECTION_CONTOURANALYZER_H_
#include <string>
#include <opencv2/opencv.hpp>
#include "../../UI.h"
#include "../../UIListener.hpp"
class ContourAnalyzer: public UIListener {
int *lastKey;
bool cannyRec = false;
UI *ui;
std::vector<std::vector<cv::Point>> contours;
std::vector<std::vector<cv::Point>> inconsistentContours;
std::vector<std::vector<cv::Point>> consistentContours;
std::vector<std::vector<cv::Point>> prunedContours;
std::vector<cv::Rect> bounds;
public:
int binLower = 60;
int cannyLower = 35;
int cannyUpper = 105;
int epsilon = 48;
ContourAnalyzer(UI* ui, int *lastKey);
virtual ~ContourAnalyzer();
cv::Scalar selectColor { 0, 255, 0 };
cv::Scalar fontColor { 0, 0, 255 };
void analyze();
void drawContoursOntoMat(std::vector<std::vector<cv::Point>> &contours, cv::Mat &frame);
std::string contourToString(std::vector<cv::Point>);
void convertContoursToBounds();
std::vector<cv::Rect> getBounds() const;
void componentSetup();
};
#endif /* RECTANGLE_DETECTION_CONTOURANALYZER_H_ */