BW2 = bwpropfilt(BW,attrib,range)
extracts all connected components (objects) from a binary image
BW whose value of property attrib is
in the specified range. bwpropfilt returns a
binary image BW2 containing only those objects that meet the
criteria.
BW2 = bwpropfilt(BW,attrib,n) sorts
the objects based on the value of the specified property, attrib,
returning a binary image that contains only the top n largest
objects. In the event of a tie for n-th place, bwpropfilt keeps
only the first n objects in BW2.
BW2 = bwpropfilt(BW,attrib,n,keep)
specifies whether to keep the n largest objects or the
n smallest objects when sorted by property
attrib.
BW2 = bwpropfilt(BW,I,attrib,___)
sorts objects based on the intensity values in the grayscale image
I and the property attrib.
BW2 = bwpropfilt(BW,___,conn)
specifies the pixel connectivity, conn.
Use filtering to create a second image that contains only those regions in the original image that do not have holes. For these regions, the Euler number property is equal to 1. Display filtered image.
BW2 = bwpropfilt(BW,'EulerNumber',[1 1]);
figure
imshow(BW2)
title('Regions with Euler Number == 1')
Number of object to return, specified as a positive integer.
Data Types: double
keep — Objects to retain 'largest' (default) | 'smallest'
Objects to retain, specified as 'largest' or 'smallest'.
Data Types: char | string
I — Marker image grayscale image
Marker image, specified as a grayscale image, the same size
as the input binary image. Intensity values in the grayscale image
define regions in the input binary image.
conn — Pixel connectivity 8 (default) | 4 | 3-by-3 matrix of 0s and 1s
Pixel connectivity, specified as one of these values.
Value
Meaning
Two-Dimensional Connectivities
4-connected
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.
8-connected
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.
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.