Fill the spaces between circles

2 visualizzazioni (ultimi 30 giorni)
Elena
Elena il 4 Dic 2019
Risposto: Image Analyst il 5 Dic 2019
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!
  1 Commento
darova
darova il 4 Dic 2019
I think it's impossible
Don't know if somebody can do this

Accedi per commentare.

Risposta accettata

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

Accedi per commentare.

Più risposte (1)

Image Analyst
Image Analyst il 5 Dic 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.

Prodotti


Release

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by