how can I obtain Boundary of an image with morphological operators?

how can I obtain Boundary of an image with morphological operators? for example my image is A...I want to obtain Boundary and fill Within the image. thanks

1 Comment

ok thanks Image Analyst and Matt
if I want to fill my image I should use an other input arguments for imerode...do you know what I can use?

Sign in to comment.

 Accepted Answer

I agree with Matt J. If you want an image you could also use bwperim(). To do it morphologically you'd call imerode() to shrink the blobs out one layer, then subtract that from the original
perimImage = binaryImage - imerode(binaryImage);

7 Comments

Hi Sean
It is a good idea Sean thanks. But I am beginner...
I use that you say but I have this error
Error using imerode (line 121)
Not enough input arguments
What are the other arguments?
I guess it doesn't do a 3x3 by default so you need to pass it in.
perimImage = xor(binaryImage,imerode(binaryImage, true(3)));
oh thanks Image Analyst it can dose what I want...
thanks Sean
thanks Matt
Why not just use bwperim()? It does the same thing in a simpler call. If we're done, please mark my Answer as "Accepted".
Sure Image Analyst but when I want to run imfill it wants to select some points and Because of this my result has a little Differences.but I ask a new question for this and hope that you help me.
No it doesn't. I do it all the time. Just do this:
filledImage = imfill(binaryImage, 'holes');
Again, I do it all the time so I know for a fact that it works.

Sign in to comment.

More Answers (1)

Matt J
Matt J on 5 Sep 2014
Edited: Matt J on 5 Sep 2014
You can use bwboudaries to find the boundaries, but if you're just going to end up filling them, you could probably just use imfill.

Categories

Tags

No tags entered yet.

Asked:

on 5 Sep 2014

Edited:

on 6 Sep 2014

Community Treasure Hunt

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

Start Hunting!