HOw can I use Morphological commands for boundary?

Hello All,I want to remove boundary around an image and I want to know how can morphological commands help me? Which command of morphological commands should I use? I have attached the image that I want to remove the boundary around it.

Answers (1)

Image Analyst
Image Analyst on 21 Jan 2014
Edited: Image Analyst on 21 Jan 2014
Try imerode.
  1. threshold to get a binary image.
  2. call imerode
  3. subtract from original binary image
  4. erase boundary: grayImage(binaryImage) = 0
If it doesn't do what you want, then attach your code.

3 Comments

Thanks for your answer, I have tried but it's not what I want,it gives me back the binary image I want the gray scale image without boundaries. I want to remove only the boundaries around the image because they are highlighted.This is the codes:
%threshold
background=imopen(a,strel('disk',15)); a2=a - background; a3=imadjust(a2); level = graythresh(a3); bw = im2bw(a3,level); bw = bwareaopen(bw, 50); figure,imshow(bw,[]);
%imerode
se = strel('disk',11); IM2=imerode(bw,se); figure,imshow(IM2,[]);
%subtract
IM3 = IM2-bw;
figure,imshow(IM3,[]);
%erase
a(IM3) = 0;
figure,imshow(a,[]);
Explain in more detail what you consider the "boundaries" of that image to be.
Boundaries around the image,which are highlighted,not inside the image,just around the image. I applied canny to the image and after that I used 'bwconncomp' so that I can find the connected components and then I erased the largest one,but still it has the boundary.and also in this method that I tried I don't know how to back to gray scale from binary(canny).
in the attachment the image 2 is the canny of the main picture,and the image named 3 is the one that I erased the largest connected component. I want to remove the other largest component which appears to be the boundary of the image.

Sign in to comment.

Asked:

on 21 Jan 2014

Commented:

on 21 Jan 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!