MATLAB Answers

Fill the spaces between circles

2 views (last 30 days)
Elena on 4 Dec 2019
Answered: Image Analyst on 5 Dec 2019
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".

  1 Comment

darova on 4 Dec 2019
I think it's impossible
Don't know if somebody can do this

Sign in to comment.

Accepted Answer

J. Alex Lee
J. Alex Lee on 4 Dec 2019
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).


Elena on 4 Dec 2019
It's correct. It is exactly the criterion with which the shaded regions were chosen!
J. Alex Lee
J. Alex Lee on 5 Dec 2019
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.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 5 Dec 2019
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.


Sign in to comment.

Sign in to answer this question.