How can I draw a special circle separated by two colors?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all.. I knew how to draw a complete circle separated by two color through asking question as following.
c=1+2j % circle centre
r=4 % radius
x=real(c)-r:0.01:real(c)+r
y1=sqrt(r^2-(x-real(c)).^2)+imag(c)
plot(x,y1,'r')
hold on
plot(x,-y1+2*imag(c),'b')
axis square
Ultimately, I am planning to draw two colored circles (including gray, white) of following picture.
Which code can I use to draw special circle?
I'd like to accept advice or idea from many people as far as possible.
댓글 수: 0
답변 (1개)
Image Analyst
2012년 10월 26일
I'd do it in Photoshop and then just read it in as an image. Why do it the hard way like trying to recreate it via MATLAB? You haven't said if any of your parameters will change from run to run, so I'm assuming that they won't and they'll just use the constant values you gave, like radius = 4, etc. If any of them need to change on a run-by-run basis you should have / would have said so. So that's why I say to use Photoshop (or GIMP or Paint).
댓글 수: 4
Image Analyst
2012년 10월 26일
try doing the inner and outer arcs then using poly2mask to get a binary image of the center of the arc filled in. Then apply the mask to the image
arcImage = poly2mask(coords, rows, columns);
grayImage(arcImage) = 200; % or whatever value the color gray is.
or something like that.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!