BW2 = bwareafilt(BW,range)
extracts all connected components (objects) from the binary image
BW, where the area of the objects is in the specified
range, producing another binary image
BW2. bwareafilt returns a binary image
BW2 containing only those objects that meet the
criteria.
Number of objects to include when filtering image objects by size,
specified as a positive integer.
Data Types: double
Size of objects to include in the output image, specified as
"largest" or "smallest". In the
event of a tie for n-th place,
bwareafilt includes only the first
n objects.
Data Types: char | string
Pixel connectivity, specified as one of these values.
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.
bwareafilt supports the generation of C
code (requires MATLAB®
Coder™). Note that if you choose the generic MATLAB Host Computer
target platform, bwareafilt generates code that uses a precompiled,
platform-specific shared library. Use of a shared library preserves performance optimizations
but limits the target platforms for which code can be generated. For more information, see Types of Code Generation Support in Image Processing Toolbox.
The keep argument must be a compile-time
constant.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.