<< Structural Analysis and Shape Descriptors Structural Analysis and Shape Descriptors imdrawcontours >>

IPCV >> Structural Analysis and Shape Descriptors > imconvexHull

imconvexHull

Finds the convex hull of a point set.

Syntax

H = imconvexHull(pts)

Parameters

pts :

Input 2D point set.

H :

Output convexhull

Description

The functions find the convex hull of a 2D point set using the Sklansky's algorithm.

Examples

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');

See also

Authors

Bibliography

1. OpenCV 2.4 Online Documentation


Report an issue
<< Structural Analysis and Shape Descriptors Structural Analysis and Shape Descriptors imdrawcontours >>