【发布时间】:2019-02-01 00:30:55
【问题描述】:
Mat frame;
Mat frame2;
Mat output_frame;
Mat imgray;
Mat imgCanny;
vector<vector<Point> > contours;
vector<Point> approx;
Mat img = imread("abc.jpg");
cvtColor(img, imgray, COLOR_BGR2GRAY);
Canny(imgray, imgCanny, 10, 100, 3, false);
findContours(imgCanny, contours, RETR_TREE, CHAIN_APPROX_SIMPLE);
double eps = 0.1 * arcLength(contours[0], true);
approxPolyDP(contours[0], approx, 1, true);
drawContours(img, approx, 0, (0, 255, 0), 1); // Here has Error..
我研究过OpenCV,但是drawContours方法(?)很奇怪。
我的意思是其他drawContours 已经完成(drawContours(img,contours,0,(0,255,0),1);)
但是drawContours(img, approx, 0, (0, 255, 0), 1); 有错误。
为什么?
我确认近似值有数据(4 个点)
【问题讨论】: