# IMAGE PROCESSING

" Two roads diverged in a wood, and I,
I took the one less traveled by,
And that has made all the difference "-Robert Frost

### Boundary Extraction in MATLAB

Boundary Extraction in MATLAB
Let A be an Image matrix and B be a structuring element.

Formula for Boundary Extraction:

Steps to be followed:
·         Convert the image into binary image.
·         Perform Erosion:
Erode binary image A by structuring element B. (i.e)

·         Subtraction:
Subtract the binary image A from the Eroded image.(i.e)

``````

``````

C=rgb2gray(A);

C(C<225)=0;

s=strel('disk',4,0);%Structuring element

D=~im2bw(C);%binary Image

F=imerode(D,s);%Erode the image by structuring element

figure,imshow(A);title('Original Image');

figure,imshow(D);title('Binary Image');
``````

``````

%Difference between binary image and Eroded image

figure,imshow(D-F);title('Boundary extracted Image');
```
```

Example 2:

``````

s=strel('disk',2,0);

F=imerode(A,s);

figure,

subplot(2,1,1);

imshow(A);title('Binary Image');

subplot(2,1,2);

imshow(A-F);title('Boundary extracted Image');
``````

Like "IMAGE PROCESSING" page