std::vector<std::vectorcv::Point > contours;
cv::Mat image = cv::imread("");
只检索最外面的轮廓且用端点代替直线段(水平,竖直、对角线)
cv::findContours(image, contours, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE, cv::Point(0, 0));
cv::Rect rect = cv::boundingRect(contours[0]);
cv::Point point = cv::Point(2, 2);
false只判断,true返回具体距离
double a = cv::pointPolygonTest(contours[0], point, false)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)