How to shrink a binary image of an irregular object?

I have a binary image of an irregular object. Any clue on how to shrink this object, for example, by 20pixel from all directions?
I tried tracing the boundary and edit the coordinates but it was not practical.

 Accepted Answer

A few ways:
doc imerode
Or if you need to maintain objects:
doc bwmorph
Look at the skel and thin options.

3 Comments

Hi Sean, I tested IM2=bwmorph(IM,'thin',19) and it works perfect! in shaving 19pixels off the perimeter of my square phantom (the binary object). I am preparing the code for patient images. Does it work as well for body contour? I don't have any proper image to work with yet.
You'll have to try it :)
I hope it works! Anyway, thank you very much for pointing me to the right function :)

Sign in to comment.

More Answers (0)

Asked:

on 27 Mar 2014

Commented:

on 27 Mar 2014

Community Treasure Hunt

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

Start Hunting!