凸包检测
cv::Mat src = cv::imread("1.jpg");
if (!src.data)
{
cout << "error" << endl;
return -1;
}
cv::Mat gray, dst, thresholdImage;
cv::RNG rng(12345);
vector<vector<cv::Point> > contours;
cv::cvtColor(src, gray, cv::COLOR_BGR2GRAY);
cv::blur(gray, gray, cv::Size(3, 3));
cv::threshold(gray, thresholdImage, 170, 255, CV_THRESH_BINARY);
cv::findContours(thresholdImage,
contours,
CV_RETR_TREE,
CV_CHAIN_APPROX_SIMPLE);
vector<vector<cv::Point>>hull(contours.size());
for (unsigned int i = 0; i < contours.size(); i++)
{
cv::convexHull(cv::Mat(contours[i]),
hull[i],
false);
}
dst = cv::Mat::zeros(thresholdImage.size(), CV_8UC3);
for (unsigned<