在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
From: https://ww2.mathworks.cn/help/images/ref/bwareaopen.html bwareaopenRemove small objects from binary image Syntax
Description
ExamplesRemove Objects in Image Containing Fewer Than 50 PixelsTry This Example Read binary image.
Remove objects containing fewer than 50 pixels using
Display original image next to morphologically opened image.
Input Arguments
|
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. |
|
Three-Dimensional Connectivities |
||
6-connected |
Pixels are connected if their faces touch. Two adjoining pixels are part of the same object if they are both on and are connected in:
|
|
18-connected |
Pixels are connected if their faces or edges touch. Two adjoining pixels are part of the same object if they are both on and are connected in
|
|
26-connected |
Pixels are connected if their faces, edges, or corners touch. Two adjoining pixels are part of the same object if they are both on and are connected in
|
For higher dimensions, bwareaopen
uses the default value
.conndef
(ndims(BW),'maximal')
Connectivity can also be defined in a more general way for any dimension by specifying a 3-by-3-by- ... -by-3 matrix of 0
s and 1
s. The 1
-valued elements define neighborhood locations relative to the center element of conn
. Note that conn
must be symmetric about its center element. See Specifying Custom Connectivities for more information.
Data Types: double
| logical
BW2
— Image that has been morphologically openedImage that has been morphologically opened, specified as a nonsparse, logical array the same size as BW
.
The basic steps are
Determine the connected components:
CC = bwconncomp(BW, conn);
Compute the area of each component:
S = regionprops(CC, 'Area');
Remove small objects:
L = labelmatrix(CC);
BW2 = ismember(L, find([S.Area] >= P));
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论