Monday, April 23, 2012


PROJECT  TITLE:  Boundary Extraction By Dilation and Erosion (With MatLab)

Write a computer program to implement morphological boundary extraction capable of performing binary dilation and erosion with an arbitrary structuring element of size 3 x 3 that can be specified by the user.
ABSTRACT:
Mathematical morphology is one of the data processing methods that is extremely useful for image processing and has many applications, such as, boundary extraction ,noise elimination, shape description, texture analysis, and so on. The mathematical base of morphological processing is dilation and erosion which are described by set analysis and can be expressed in logical AND, OR notation .The objective of this project is to write a program capable of performing binary dilation and erosion with an arbitrary structuring element of size 3 x 3 that can be extracted the boundary or edge of an image. To simulate these two operations, image processing toolbox functions of MATLAB programming language is used.
Morphology, Dilation and Erosion:
¨  Morphology: The word morphology signifies the study of form or structure. In image processing we use mathematical morphology as a means to identify and extract meaningful image descriptors based on properties of form or shape within the image.
¨  Dilation: Dilation is an operation that ‘grows’ or ‘thickense’ objects in a binary image.  Mathematically, dilation is defined in terms of set operations. The dilation of A and B is defined as  
                                                                                          
 ¨  Erosion: Erosion is an operation that ‘Shrinks’ or ‘thins’ objects in a binary image. The mathematical definition of erosion of A by B is defined as
                                                                                             
¨  Structuring Element: A structuring element is a rectangular array of pixels containing the values either 1 or 0 (akin to a small binary image). Structuring elements have a designated center pixel. An example of Structuring element 


Fig 1: The local neighborhood defined by a structuring element. This is given by those shaded pixels in the image which lie beneath the pixels of value 1 in the structuring element

In Matlab, to construct the structuring element array by using ‘strel’ function. The example below illustrates how Matlab displays when a strel object is created:

>> se3 = strel (‘disk ’, 3); % A disk of radius 3

Which displays the matrix as follows:


Algorithm for Boundary Extraction:

¨  Erosion Algorithm: The boundary of a set A, denoted by β(A), can be obtained by first eroding A by B and then performing the set differences between A and its erosion. That is,
              β(A)=A – (AΘB)
            where B is a suitable structuring element. ‘‘ is the difference operation on sets.

¨  Dilation Algorithm: The boundary of a set A, denoted by β(A), can be obtained by first dilating A by B and then performing the set differences between A and its erosion. That is,
            β(A)= (A  B) – A
            where B is a suitable structuring element. ‘‘ is the difference operation on sets.

Dilation Operation:  Three pixel-long diagonal line with the origin at the center


When the structuring element overlaps 1-valued pixels, the pixel at the origin is marked 1. In Matlab, we can carry out image dilation using the Image Processing Toolbox functions imdilate.
>>imdilate_image = imdilate(Orginal_binary_image,structuring_element_array);

Erosion Operation: a three-pixel-long vertical line with the origin at the center


In Matlab, we can carry out image erosion using the Image Processing Toolbox functions “imerode”.
>>imerode_image = imerode(Orginal_binary_image , structuring_element_array);


Results of Dilation:




Results of Erosion:


Discussion:

In the above result, it is shown that the two morphological operations of Dilation and Erosion is applied for our selected black and white image. To simulate these two operations, image processing toolbox functions of MATLAB programming language is used.  

At first the original image (linkon.tif) is represented to the Binary image by using the matlab built-in function of imread(). And then I select structuring element of size 3 x 3 long diagonal line for dilation and structuring element of size 3 x 3 long vertical line.

The  matrix is generated by using the Matlab image processing toolbox functions. The matrix has a 1-valued center pixel and R is the radius of the disc which is 3 here.  For the dilation process, I need two images where A is the original image and B is the structuring element considering as a subimage. Then applying the dilation process by using equation (1) which grows or thickens objects of the binary image Fig 2(a)  with matlab function of imdilate() and Fig 2(B) has got after dilation. Next, the boundary extraction algorithm for dilation is applied and extracts the boundary from the original image and finally got the Fig 2(C).
In similar way, to extract the boundary of original image by using erosion process need to represent the image as binary then create an structuring element of size 3x3 Then applying the erosion process by using equation (2) which Shrinks or thins objects of the binary image Fig 3(a) with matlab function of imerode() and Fig 3(B) has got after erosion. After completing the erosion process then apply the boundary extraction algorithm to extract the boundary from the original image and got the Fig 3(C).
So, the objective in this project is to extract the boundary of an image performing two binary dilation and erosion operation with an arbitrary structuring element of size 3 x 3. Now the project is successfully completed and extracted the boundary from any types of binary image.

Appendix:

¨  Boundary Extraction with the help of Dilation:
            A=imread('linkon.tif');
            s=strel('disk',3);           %Structuring element
            F=imdilate(A,s);          %Dialte the image by structuring element
             figure,imshow(A);title('Original Image');
            figure,imshow(F);title('Imdilate Image');
            figure,imshow(F-A);title('Boundary extracted Image with using imdilate');

¨  Boundary Extraction with the help of Erosion:
            A=imread('linkon.tif');
s=strel('disk',3)            %Structuring element
            F=imerode(A,s);          %Erode the image by structuring element
            figure,imshow(A);title('Original Image');
            figure,imshow(A-F);title('Boundary extracted Image with using imerode');

References
1. "Fundamentals of Digital Image Processing", Chris Solomon and Toby Breckon, Wiley Publications. 1st edition.
2. “Digital Image Processing Using Matlab”, Rafael C. Gonzalez, Richard E. Woods and Steven L. Eddins, 2nd edition.
3. “Discrete Mathematics”, Seymour Lipschutz and Marc Lars Lipson, 2nd edition, Mcgraw-hill publication.