#pragma once #include "ImageApply.h" #include #include #include #include using namespace cv; class ImageOutHole { public: ImageOutHole(void); ~ImageOutHole(void); public: void puncture(Mat& front, Mat& back, double threshold, float edgeScale, double areaThreshold); private: cv::Mat threshold_mat(const Mat& src, double threshold); void findContours22(const Mat& src, vector>& contours, vector& hierarchy, int retr = RETR_CCOMP, int method = CHAIN_APPROX_SIMPLE, Point offset = Point(0, 0)); vector getMaxContour(const vector>& contours, const vector& hierarchy, int areaThreshold = 20000); void getRoi(RotatedRect rrect_front, RotatedRect rrect_back, Size srcSize, Rect& roi_front, Rect& roi_back, RotatedRect& mask_rotatedRect); Point rotatedPoint(Point p, Point center, double angle); vector getVertices(RotatedRect rect); void filterPoly(const Mat& mask, vector>& contours, RotatedRect roi, float edgeScale, double areaThreshold); void fillPuncture(Mat& src, const Mat& mask, Rect roi); };