create a white circle or sphere inside a black box
Mostrar comentarios más antiguos
i have created white boxes inside a big black box as follows:
A=zeros(70,70); % black box
A(15:23,50:55)=1;% white box
A(50:60,50:55)=1;% white box
A(20:23,10:13)=1 ;% white box
imshow(A,[])
how can i add to the same matrix A a white circle or a white sphere?thanks in advance.
Respuesta aceptada
Más respuestas (3)
Friedrich
el 21 de Jul. de 2011
Hi,
can this help?
function out = my_circ( A, midpoint, radius )
out = A;
[ m n] = size(A);
for i=1:m
for j=1:n
if norm( [i,j] - midpoint ) <= radius
out(i,j) = 1;
end
end
end
end
And call it through:
>> A = zeros(100);
>> B = my_circ(A,[40,40],10);
>> imshow(B,[]);
Ujitha
el 3 de Mzo. de 2013
0 votos
Hi this was really helpful. How do you do this to create two different sizes of circles.
Thanks inadvance
1 comentario
Image Analyst
el 3 de Mzo. de 2013
Ujitha
el 4 de Mzo. de 2013
0 votos
Thanks a lot. It was really helpful..!
Categorías
Más información sobre Univariate Discrete Distributions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!