Generate convex hull image from binary image
CH = bwconvhull(BW)
CH = bwconvhull(BW, method)
CH = bwconvhull(BW, 'objects', conn)
A logical 2-D image
A string that can have the following values:
Connectivity. Can have the following scalar values:
Additionally, conn may be defined in a more general way, using a 3-by-3 matrix of 0s and 1s. The 1-valued elements define neighborhood locations relative to conn's center element. conn must be symmetric about its center element.
A logical, convex hull image, containing the binary mask of the convex hull of all foreground objects in BW.
Display the binary convex hull of an image:
subplot(2,2,1); I = imread('coins.png'); imshow(I); title('Original'); subplot(2,2,2); BW = I > 100; imshow(BW); title('Binary'); subplot(2,2,3); CH = bwconvhull(BW); imshow(CH); title('Union Convex Hull'); subplot(2,2,4); CH_objects = bwconvhull(BW,'objects'); imshow(CH_objects); title('Objects Convex Hull');