Thursday, June 17, 2010

Matlab Code for Dilation and Erosion

DILATION:

The process of dilation here involves a structuring element of order 3*3 or any odd order, the values to each of its pixels is binary 1.the central pixel of the structuring element imposes on each of the pixel of the object or the image.if the value of the centre pixel of the structuring element and object is the same i.e 1(one),it assigns all the overlapping pixels the value of 1.that is it dilates the image or the object.otherwise it moves to the next pixel.

For writing the code in Matlab for dilation, we need to use 'if ' condition in this way:


If ((origin of structuring element) ==255) then make all pixels 1 for whole range of structuring element. This was our pseudo code for process of dilation.




EROSION:

The process of erosion here involves a structuring element of order 3*3.the values to each of its pixels is binary 1. the central pixel of the structuring element imposes on each of the pixel of the object or the image.if the value of the centre pixel of the structuring element and all the pixels overlappin with the pixels of the object are the same i.e if they are 1,keep the pixel.otherwise move to the next pixel.

The pseudo code for erosion process is like this:


If((origin of structuring element) == 255 && (whole range of structuring element) ==255*9) then center will remain equal to 1.

No comments:

Post a Comment