Ultimate erosion
Read a binary image into the workspace and display it.
originalBW = imread('circles.png');
imshow(originalBW)
Perform the ultimate erosion of the image and display it.
ultimateErosion = bwulterode(originalBW); figure, imshow(ultimateErosion)
BW
— Binary imageBinary image, specified as a numeric or logical array of any dimension. For numeric input,
any nonzero pixels are considered to be 1
(true
).
Example: BW = imread('circles.png')
;
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
method
— Distance transform method'euclidean'
(default) | 'quasi-euclidean'
| 'cityblock'
| 'chessboard'
Distance transform method, specified as one of the values in this table.
Method | Description |
---|---|
'chessboard' | In 2-D, the chessboard distance between (x1,y1) and (x2,y2) is
max(│x1 – x2│,│y1 – y2│).
|
'cityblock' | In 2-D, the cityblock distance between (x1,y1) and (x2,y2) is
│x1 – x2│ + │y1 – y2│
|
'euclidean' | In 2-D, the Euclidean distance between (x1,y1) and (x2,y2) is
|
'quasi-euclidean' | In 2-D, the quasi-Euclidean distance between (x1,y1) and (x2,y2) is
|
For more information, see Distance Transform of a Binary Image.
conn
— Pixel connectivity4
| 8
| 6
| 18
| 26
| 3-by-3-by- ... -by-3 matrix of 0
s and
1
sPixel connectivity, specified as one of the values in this table. The default
connectivity is 8
for 2-D images, and 26
for 3-D
images.
Value | Meaning | |
---|---|---|
Two-Dimensional Connectivities | ||
4-connected | Pixels are connected if their edges touch. The neighborhood of a pixel are the adjacent pixels in the horizontal or vertical direction. | |
8-connected | Pixels are connected if their edges or corners touch. The neighborhood of a pixel are the adjacent pixels in the horizontal, vertical, or diagonal direction. | |
Three-Dimensional Connectivities | ||
6-connected | Pixels are connected if their faces touch. The neighborhood of a pixel are the adjacent pixels in:
| |
18-connected | Pixels are connected if their faces or edges touch. The neighborhood of a pixel are the adjacent pixels in:
| |
26-connected | Pixels are connected if their faces, edges, or corners touch. The neighborhood of a pixel are the adjacent pixels in:
|
For higher dimensions, bwulterode
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
— Eroded imageEroded image, returned as a logical array of the same size as
BW
.
Data Types: logical
You have a modified version of this example. Do you want to open this example with your edits?