Morphology refers to shape or structure. In image processing, classical morphological operations are treatments done on binary images, particularly aggregates of 1's that form a particular shape, to improve the image for further processing or to extract information from it. All morphological operations affect the shape of the image in some way, for example, the shapes may be expanded, thinned, internal holes could be closed, disconnected blobs can be joined. In a binary image, all pixels which are “OFF” or have value equal to zero are considered background and all pixels which are “ON” or 1 are foreground.
We will deal with two types of morphological operation, dilation and erosion.
and
The erosion operator is defined as
For this activity we will use 5 binary images.
1. square ( 50 x 50)
2.triangle (base = 50 , height = 30)
3. circle (radius 25)
4. hollow square (60×60, edges are 4 pixels thick)
5. plus sign (8 pixels thick and 50 pixels long for each line)
and we will use structuring element for dilation and erosion
1. 4×4 ones
2. 2×4 ones
3. 4×2 ones
4. cross, 5 pixels long, one pixel thick.
The algorithm for dilation is:
img = imread('filename.bmp');
SE = [1 1 1 1; 1 1 1 1; 1 1 1 1; 1 1 1 1];
SE2 = [ 1 1 1 1; 1 1 1 1];
SE3 = [ 1 1; 1 1; 1 1; 1 1];
SE4=[0 0 1 0 0; 0 0 1 0 0; 1 1 1 1 1; 0 0 1 0 0; 0 0 1 0 0];
im = dilate(img,SE);
im2 = dilate(img, SE2);
im3 = dilate(img, SE3);
im4 = dilate(img, SE4);
imwrite(im, 'filename1.bmp');
imwrite(im2, 'filename2.bmp');
imwrite(im3, 'filename3.bmp');
imwrite(im4, 'filename4.bmp');
Dilation:
img = imread('filename.bmp');
SE = [1 1 1 1; 1 1 1 1; 1 1 1 1; 1 1 1 1];
SE2 = [ 1 1 1 1; 1 1 1 1];
SE3 = [ 1 1; 1 1; 1 1; 1 1];
SE4=[0 0 1 0 0; 0 0 1 0 0; 1 1 1 1 1; 0 0 1 0 0; 0 0 1 0 0];
im = erode(img,SE);
im2 = erode(img, SE2);
im3 = erode(img, SE3);
im4 = erode(img, SE4);
imwrite(im, 'filename1.bmp');
imwrite(im2, 'filename2.bmp');
imwrite(im3, 'filename3.bmp');
imwrite(im4, 'filename4.bmp');
Other morphological operations
thin - thinning by border deletion
use thin in the original square image.
skel - skeletonization, thinning, Medial Axis Transform
Acknowledgements:
Activity 8 Manual
BETH
JULIE
AIYIN
ANGEL
APRIL
- for helping me.
Grade:
10/10 - because sone of my predictions are right with the simulated image.
0 comments:
Post a Comment