Skip to content
Search

Convex hull

lastmod 2023-01-12created 2022-07-128 edits

The set formed by connecting the outermost points among a number of points. All points must lie inside the Convex Hull region, and no points may lie outside it.

General procedure

It is usually used in the following order.

  1. Turn the original image into a binary image using cv2.threshold
  2. Extract the image contours using cv2.findContours
  3. Connect the outermost lines using cv2.convexHull.
  4. (If needed) draw it with cv2.drawContours.
hull = cv2.convexHull(cnt)
cv2.drawContours(img1, [hull], 0, (0, 255, 0), 3)

Cv2_convexHull_sample.png

See also

Favorite site

author Zer0 sitemap