How to fill the region within the boundaries?

4 views (last 30 days)
Hi Matlab Community,
I am trying to segment the enclosed area from the background to find the area of the shape. How can I fill in the region within the enclosed area to find the area of the shape?
Your help is very much appreciated.
Thank you.
  3 Comments
Image Analyst
Image Analyst on 22 Oct 2013
Edited: Image Analyst on 22 Oct 2013
I don't see any enclosed areas. Not one. I just see some white dots and some 8-connected lines, but none of those form a completely closed region. What do you consider to be closed? Each "stripe"? The dotted boundary?
(By the way, tags don't need to use # - this isn't Twitter, it's MATLAB Answers. Similarly you won't need to use @ before you address someone like in Twitter, like a lot of others do.)
Epah
Epah on 23 Oct 2013
Hi All,
I am trying to fill in the region within the dotted boundaries white and the background black. How can I do that?

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 23 Oct 2013
Try a concave hull, also known as restricted convex hull. I'm not sure MATLAB has a function for that yet. I know I've discussed with with them but I can't remember if they've added it yet or not. Not that I remember off the top of my head anyway. So in the meantime, look at this: http://ubicomp.algoritmi.uminho.pt/local/concavehull.html I do have some demo code for concave hull - it's not very efficient though, but for what it's worth, it's attached.
  2 Comments
Matt Kindig
Matt Kindig on 23 Oct 2013
Another approach that I've used to accomplish this task -- outlining a non-concave area -- is alpha shapes. There are a variety of alpha shape algorithms on the File Exchange -- the one that I've found useful is by user 'us', and is called ashape().
Image Analyst
Image Analyst on 23 Oct 2013
I agree, and here's a link for alpha shapes. http://cgm.cs.mcgill.ca/~godfried/teaching/projects97/belair/alpha.html One property of alpha shapes though is that the shape doesn't always go through the vertices like concave hull does, as you can see in the link sample image. However, if his later duplicate posting he said that concave hull was too complicated for him, and if a intuitive, conceptually simple algorithm like concave hulls is too complicated, there's no hope for alpha shapes. Perhaps he can get by with treating us's program like a black box and not worry about understanding it - I don't know.

Sign in to comment.

More Answers (0)

Categories

Find more on Bounding Regions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!