Read a grayscale image into the workspace. Convert it into a binary image and calculate the union binary convex hull. Finally, calculate the objects convex hull and display all the images in one figure window.

method — Method used to compute the convex hull 'union' (default) | 'objects'

Method used to compute the convex hull, specified as one of the following:

Value

Description

'union'

Compute the convex hull of all foreground objects, treating
them as a single object

'objects'

Compute the convex hull of each connected component of BW individually. CH contains
the convex hulls of each connected component.

Data Types: char | string

conn — Pixel connectivity 8 (default) | 4 | 3-by-3 matrix of 0s and 1s

Pixel connectivity, specified as one of these values The
conn parameter is only valid when the
method is 'objects'.

Value

Meaning

Two-Dimensional Connectivities

4

Pixels are connected if their edges touch. Two adjoining pixels are
part of the same object if they are both on and are connected along the
horizontal or vertical direction.

Current pixel is shown in gray.

8

Pixels are connected if their edges or corners touch. Two adjoining
pixels are part of the same object if they are both on and are connected
along the horizontal, vertical, or diagonal direction.

Current pixel is shown in gray.

Connectivity can also be defined in a more general way by specifying a
3-by-3 matrix of 0s and 1s. The
1-valued elements define neighborhood locations
relative to the center element of conn. The matrix must
be symmetric about its center element.

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.