Title: Erosion:
1Erosion
- Erosion is used for shrinking of element A by
using element B - One of the simplest uses of erosion is for
eliminating irrelevant details from a binary
image. -
Erosion
2Erosion
3Typical Uses of Erosion
- Removes isolated noisy pixels.
- Smoothes object boundary(removes spiky edges).
- Removes the outer layer of object pixels
- - Object becomes slightly smaller.
- - Sets contour pixels of object to
background value
4Erosion Example
5Erosion explained pixel by pixel
A
B
6Structuring Element in Erosion Example
7How It Works?
- During erosion, a pixel is turned on at the image
pixel under the structuring element origin only
when the pixels of the structuring element match
the pixels in the image - Both ON and OFF pixels should match.
- This example erodes regions horizontally from the
right.
8Structuring Element in Erosion Example
9Structuring Element in Erosion Example
10Structuring Element in Erosion Example
11Structuring Element in Erosion Example
12Structuring Element in Erosion Example
13Structuring Element in Erosion Example
14Mathematical Definition of Erosion
- Erosion is the morphological dual to dilation.
- It combines two sets using the vector subtraction
of set elements. - Let denotes the erosion of A by B
15Erosion explained pixel by pixel
A
B
(1,1) (0,0) (1,1) (1,2) (0,0) (1,2) (1,3) (0,0) (1,3) (1,4) (0,0) (1,4) (0,4) (0,0) (0,4) (2,4) (0,0) (2,4) (3,4) (0,0) (3,4) (4,4) (0,0) (4,4) (1,1) (1,0) (0,1) (1,2) (1,0) (0,2) (1,3) (1,0) (0,3) (1,4) (1,0) (0,4) (0,4) (1,0) (-1,4) (2,4) (1,0) (1,4) (3,4) (1,0) (2,4) (4,4) (1,0) (3,4)
16Properties of Erosion
- Linearity
- Decomposition of structuring element
- Erosion is not commutative!
17Erosion
18In MATLAB Codes
- strelThis function creates amorphological
structuring element. SEstrel(shape,parameters) - Erosion image
- imerode This function erosion the image.
- I2imerode(image,SE)
shape parameters
disk R
line Len,deg
square w
rectangle m n
19Codes
- A imread(Image.tif')
- figure,imshow(A)
- se strel('disk',3)
- A2 imerode(A, se)
- figure,imshow(A2)
- se strel('disk',5)
- A3 imerode(A, se)
- figure,imshow(A3)
- se strel('disk',10)
- A4 imerode(A, se)
- figure,imshow(A4)
20Example of Erosions with various sizes of
structuring elements
Structuring Element
Pablo Picasso, Pass with the Cape, 1960
21Erosion and Dilation summary
22Boundary Extraction
23 Boundary Extraction
- First, erode A by B, then make set difference
between A and the erosion - The thickness of the contour depends on the size
of constructing object B
24Boundary Extraction
25Edge detection
Dilate - original
original
Dilate
26Opening Closing
- Opening and Closing are two important operators
from mathematical morphology - They are both derived from the fundamental
operations of erosion and dilation - They are normally applied to binary images
27OPENING
- Opening of A by B, is simply erosion of A by B,
followed by dilation of the result by B. - We use opening for
- Smoothes object boundaries
- Eliminates noise (isolated pixels)
- Maintains object size
28OPENING
- Opening is defined as an erosion followed by a
dilation using the same structuring element - The basic effect of an opening is similar to
erosion but Less destructive than erosion - Does not significantly change an objects size
29Opening Example
- What combination of erosion and dilation gives
- cleaned binary image
- object is the same size as in original
Original
30Opening Example Cont
- Erode original image.
- Dilate eroded image.
- Smoothes object boundaries, eliminates noise
(isolated pixels) and maintains object size.
Dilate
Original
Erode
31CLOSING
- Closing of A by B, is dilation followed by
erosion (opposite to opening). - We use Closing for
- Smoothes object boundaries
- Eliminates noise (small holes), fills gaps in
contours and close up cracks in objects. - Maintains object size.
32Close
- Dilation followed by erosion
- Serves to close up cracks in objects and holes
due to pepper noise - Does not significantly change object size
33More examples of Closing
- What combination of erosion and dilation gives
- cleaned binary image
- object is the same size as in original
Original
34 More examples of Closing cont
- Dilate original image.
- Erode dilated image.
- Smoothes object boundaries, eliminates noise
(holes) and maintains object size.
Erode
Dilate
Original
35Open and Close
Close Dilate next Erode Open Erode next Dilate
Original image
eroded
dilated
dilated
eroded
Open
Close
36Spatial Filtering
Closing o Opening Opening o Closing
37Use of opening and closing for morphological
filtering
38Open and Close
- Original image opening opening followed by
closing
39Codes
- f imread('noisy-fingerprint.tif')
- figure,imshow(f)
- se strel('square', 3)
- fo imopen(f,se)
- figure,imshow(fo)
- foc imclose(fo,se)
- figure,imshow(foc)
40Possible problems with Morphological Operators
- Erosion and dilation clean image but leave
objects either smaller or larger than their
original size. - Opening and closing perform same functions as
erosion and dilation but object size remains the
same.