Finds the convex hull of a point set.
H = imconvexHull(pts)
Input 2D point set.
Output convexhull
The functions find the convex hull of a 2D point set using the Sklansky's algorithm.
S = imread(fullpath(getIPCVpath() + "/images/hand.jpg")); Sbw = im2bw(~S,0.5); imshow(Sbw); Sc = imfindContours(Sbw); [A, BB, ctr] = imblobprop(Sc); [maxV,maxI] = max(A); [row,col] = find(Sc==maxI); [cart_x,cart_y] = sub2cartesian(size(Sc), row,col); SS = [(cart_x)',(cart_y)']; H = imconvexHull(SS); sz = size(S); plot(cart_x,cart_y,'.'); Hd = double(H); plot(Hd(:,1),Hd(:,2),'r'); | ![]() | ![]() |
1. OpenCV 2.4 Online Documentation