How to fill the regions within the traced boundry using "bwboundaries"

9 views (last 30 days)
Hi, I am using bwboundaries to trace the boundaries. I want to know,how to fill the traced region alone with white pixels.

Accepted Answer

Dishant Arora
Dishant Arora on 19 Feb 2014
Edited: Dishant Arora on 19 Feb 2014
b=imfill(b,'holes');
  4 Comments
BAKIYA LAKSHMI
BAKIYA LAKSHMI on 19 Feb 2014
Thank you sir @ Dishant Arora. This code gives boundary binary mask,is it possible to fill the region within the boundary likewise?

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 19 Feb 2014
filledImage = poly2mask(xBoundaries, yBoundaries, rows, columns);
  6 Comments
Dishant Arora
Dishant Arora on 19 Feb 2014
@Image analyst,I guess she probably wants a binary mask having 1's only at boundary positions.
Image Analyst
Image Analyst on 19 Feb 2014
For that they'd use bwperim(). I ran the code and it does an auto-threshold and then gets the boundaries of all the regions. If that is not wanted then I need to know what is wanted. I have not heard a really clear explanation of what is wanted. I don't even know what a traced region is, as opposed to a regular connected components region that you get from thresholding. Perhaps a figure showing what the desired outcome is would be helpful if explaining it in English is difficult because English is not the native language of the poster. I'm pretty sure what is wanted is trivial if I could just understand what is wanted.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!