<< imconvexHull Structural Analysis and Shape Descriptors imdrawContours >>

IPCV >> Structural Analysis and Shape Descriptors > imconvexityDefects

imconvexityDefects

Finds the convexity defects of a contour.

Syntax

D = imconvexityDefects(contours, hullinds)

Parameters

contours :

Contours in list

hullinds :

Indices of contours which representing convex hulls in list of each contours.

D :

The output vector of convexity defects.(start_index, end_index, farthest_pt_index, fixpt_depth)

Description

The functions finds the convexity defects of a contour.

Examples

S = imread(fullpath(getIPCVpath() + "/images/star.png"));
Sbw = im2bw(S,0.5);
Sc = imfindContours(Sbw);
H = imconvexHull(Sc,0,1);
D = imconvexityDefects(Sc,H)
d = D(1);
f = Sc(1)(d(:,3),:)
[cart_ff] = rect2cart(size(S)(1:2), f);
imshow(Sbw);
plot(cart_ff(:,1),cart_ff(:,2),'g*')

See also

Authors


Report an issue
<< imconvexHull Structural Analysis and Shape Descriptors imdrawContours >>