Creating random circle patterns in an image

조회 수: 8 (최근 30일)
Jerusz
Jerusz 2015년 5월 12일
댓글: Thomas Koelen 2015년 5월 12일
I'd like to create an image containing random placed circles, like the image I attached to this post. I know how to create the image and how to put things at a random place, but I just don't know how to create the circle itself. Is there anyone who can help me?

답변 (2개)

Thomas Koelen
Thomas Koelen 2015년 5월 12일
편집: Thomas Koelen 2015년 5월 12일
Hallo Iris, je kan hier deze functie voor gebruiken.
function circle(x,y,r)
%x en y zijn de coördinaten vaan het midden van de cirkel
%r is de radius van de cirkel
%0.01 is de "hoekstap", als je met grotere cirkels werkt krijg je hiermeen soepelere cirkel, het duurt dan wel langer om deze te maken.
ang=0:0.01:2*pi;
xp=r*cos(ang);
yp=r*sin(ang);
plot(x+xp,y+yp);
end
als je meer cirkels wil kun je
hold all
of
hold on
gebruiken, de ene gebruikt telkens een andere kleur de andere dezelfde.
Hier een voorbeeld, je moet dan wel de functie die ik eerder liet zien opslaan als circle.m in je matlab path.
IM=imread('pout.tif');
imshow(IM)
hold on
for im=1:200
circle(rand*300,rand*500,rand*20)
end
resultaat:
Groetjes,
Thomas

Image Analyst
Image Analyst 2015년 5월 12일
There are FAQ entries for creating circles, arcs, ellipses, and rings: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F. I attach a circle demo that I have (not customized for you though).
If you want the circles to not overlap, that is an easy modification.
  댓글 수: 3
Image Analyst
Image Analyst 2015년 5월 12일
No. I never use the email with this account. It's just a mailinator account.
Thomas Koelen
Thomas Koelen 2015년 5월 12일
Any other way to contact you?

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by