Creating random circle patterns in an image

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일

1 개 추천

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일

1 개 추천

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

Hey Image Analyst,
Did you read the email I sent you?
Thomas
No. I never use the email with this account. It's just a mailinator account.
Any other way to contact you?

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

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

질문:

2015년 5월 12일

댓글:

2015년 5월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by