필터 지우기
필터 지우기

How to draw a circle onimage data matirx (containing linear indices to colormap)

조회 수: 1 (최근 30일)
I have written the following code to do the operation but it doesn't seem to be working????
figure
M = 64 * ones (100,100)
image (M)
o = 0:0.1:2*pi;
r = 30;
M(50,50)=32;
M(int8(50+r*cos(o)),int8(50+r*sin(o)))=0;
M(50,50)=32;
image(M)

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 2월 16일
  댓글 수: 2
simar
simar 2012년 2월 16일
Thanks for help. But if you have time could you please explain ehy my method is not mathematically stable to generate a circle??
I'm still wondering ???
Sean de Wolski
Sean de Wolski 2012년 2월 17일
If you run each of these commands separately:
int8(50+r*cos(o))
int8(50+r*sin(o))
You'll see they each create a vector. Thus the matric is going to create the equivalent of meshgrid(v1,v2) out of these two vectors. That's why you see the mesh shape in your image.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Blue에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by