Lecture
For an image, it consists of two parts:
- Background
- Foreground
A Structured Element (SE) has three parameters to consider:
- How much
- Different Shapes
- Different Size
NOTE: Look back at structuring elements and the use of erosion. Example: if you have a 5 x 20 image, where 5 is the width and 20 is the height, if you want to remove the amount of pixels vertically, you do d/2; if you want to remove the amount of pixels horizontally, you do d/4.
+—+ | 1 | <- removes one pixel at the top +—+ +—+ | 1 | <- this is the origin +—+ +—+ | 1 | <- removes one pixel at the bottom. +—+
The above graphic is used for erosion.
Opening and Closing
- Opening - It smoothens the contour of an object. Is ideal for eliminating small objects. Erosion followed by dilation.
- Closing -
MatLab: Morphology, Opening, Erosion, Dilation
In MatLab, in order to use morphology, you use the function: strel();
To use an Opening, you use imopen();
To use erosion, you use imerode();
To use dilationm you use imdilate();
Hit-or-miss Transform
It is a basic tool for shape detection in binary images. Performs erosion on the image w/ first structuring element and on the complement of the image w/ the second structuring element.