mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Update convexhull.cpp
This commit is contained in:
parent
f605373a2b
commit
9d1e8b1e1d
@ -38,23 +38,14 @@ int main( int argc, char** argv )
|
|||||||
points.push_back(pt);
|
points.push_back(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<int> hull;
|
vector<Point> hull;
|
||||||
convexHull(Mat(points), hull, true);
|
convexHull(points, hull, true);
|
||||||
|
|
||||||
img = Scalar::all(0);
|
img = Scalar::all(0);
|
||||||
for( i = 0; i < count; i++ )
|
for( i = 0; i < count; i++ )
|
||||||
circle(img, points[i], 3, Scalar(0, 0, 255), FILLED, LINE_AA);
|
circle(img, points[i], 3, Scalar(0, 0, 255), FILLED, LINE_AA);
|
||||||
|
|
||||||
int hullcount = (int)hull.size();
|
polylines(img, hull, true, Scalar(0, 255, 0), 1, LINE_AA);
|
||||||
Point pt0 = points[hull[hullcount-1]];
|
|
||||||
|
|
||||||
for( i = 0; i < hullcount; i++ )
|
|
||||||
{
|
|
||||||
Point pt = points[hull[i]];
|
|
||||||
line(img, pt0, pt, Scalar(0, 255, 0), 1,LINE_AA);
|
|
||||||
pt0 = pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
imshow("hull", img);
|
imshow("hull", img);
|
||||||
|
|
||||||
char key = (char)waitKey();
|
char key = (char)waitKey();
|
||||||
|
Loading…
Reference in New Issue
Block a user