How to fill the region within the boundaries?

3 次查看(过去 30 天)
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 个评论
Image Analyst
Image Analyst 2013-10-22
编辑:Image Analyst 2013-10-22
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 2013-10-23
Hi All,
I am trying to fill in the region within the dotted boundaries white and the background black. How can I do that?

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2013-10-23
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 个评论
Matt Kindig
Matt Kindig 2013-10-23
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 2013-10-23
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Bounding Regions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by