Fill the spaces between circles

2 次查看(过去 30 天)
Hi,
I need help to understand how to fill the spaces between lines.
I have 5 circles with this disposition:
I would like to obtain the following picture as a result, but I can't understand how:
How can I do this? I have plot the circles using the function "viscircles".
Thanks!

采纳的回答

J. Alex Lee
J. Alex Lee 2019-12-4
just a quick look, but maybe the shaded regions are shared by exactly 2 or 3 circles, not more and not fewer...does that work? as for algorithm to fill that region, maybe takes more thought (assuming above is even correct).
  2 个评论
Elena
Elena 2019-12-4
It's correct. It is exactly the criterion with which the shaded regions were chosen!
J. Alex Lee
J. Alex Lee 2019-12-5
Assuming you don't need to start from the image, but rather you have mathematical descriptions of the circle positions, an easy way would be to start with a canvas of pixels and test for its assignment in each of the circles (i.e., within radius of the center).
If you can find all the intersection points of the circles and figure out all the sides belonging to each "patch", you could test for each patch if a representative point within it (e.g., center of mass?) falls within the circles.
Neat problem.

请先登录,再进行评论。

更多回答(1 个)

Image Analyst
Image Analyst 2019-12-5
Hint: since it seems like you're using a digital image and using viscircles, just see which point is within one radius of exactly 2 or 3 of the circles. Just compute the distance of the current point, as you scan the image, to the centers of the 5 circles. It's trivial - just use Pythagorean theorem. If it is within exactly 2 or 3, then color that pixel gray, otherwise color it white. Should be pretty easy, right? Let me know if you can't figure it out.

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by