convexityDefects | R Documentation |
convexityDefects
finds the convexity defects of a polygon,
that is the area that do not belong to an object but are located inside of
its convex hull.
convexityDefects(x)
x |
A Nx2 matrix of the X-Y coordinates of a polygon (e.g., a contour
produced by |
A matrix with 4 columns:
index of the first point of the contour belonging to a convexity defect.
index of the last point of the contour belonging to a convexity defect.
index of the point of the contour belonging to a convexity defect and that is the farthest away from the convex hull.
distance between the farthest contour point and the convex hull.
Simon Garnier, garnier@njit.edu
findContours
, convexHull
dots <- image(system.file("sample_img/dots.jpg", package = "Rvision"))
dots_gray <- changeColorSpace(dots, "GRAY")
dots_bin <- dots_gray < 200
contours <- findContours(dots_bin)
contour0 <- contours$contours[contours$contours[, 1] == 0, 2:3]
convexityDefects(contour0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.