How to plot a circular Image?

조회 수: 6 (최근 30일)
ramin bba
ramin bba 2014년 7월 21일
댓글: ramin bba 2014년 7월 21일
I want to plot a binary image like this:
However, I only want the red region to be shown in the figure.How can I do this?
tnx in advance
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2014년 7월 21일
Ramin - what exactly are your inputs to draw the above? Do you determine the radius of the red circle? Do you decide on the number of solid black balls that fill the red region? Do you decide on the radius of each solid black ball?

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

채택된 답변

Image Analyst
Image Analyst 2014년 7월 21일
You can draw only the red circle by using rectangle().
For other approaches to drawing circles, see the FAQ on circles, or see my attached demos.
  댓글 수: 1
ramin bba
ramin bba 2014년 7월 21일
tnx a lot. All of them came in handy!

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

추가 답변 (1개)

Robert Cumming
Robert Cumming 2014년 7월 21일
A couple of options for you:
% First create an axes and some data:
ax = axes;
ang=0:0.01:2*pi;
xp=1*cos(ang);
yp=1*sin(ang);
patch ( xp, yp, 'w', 'parent', ax )
axis ( ax, 'equal' )
% option 1 - hide the axes to leave your image:
set ( ax, 'visible', 'off' )
% option 2 - set the background of your image to be the same as the parent:
set ( ax, 'color', get ( get ( ax, 'parent' ), 'color' ) )
  댓글 수: 2
ramin bba
ramin bba 2014년 7월 21일
thanks Robert. A question:
should I use the above after I have read my image? 'cause it is not working properly! it actually puts a disk on my current image and hides a circular portion of it! here is what I do:
a=imread('...');
imshow(a);
ax = axes;
ang=0:0.01:2*pi;
xp=1*cos(ang);
yp=1*sin(ang);
patch ( xp, yp, 'w', 'parent', ax )
axis ( ax, 'equal' )
set ( ax, 'color', get ( get ( ax, 'parent' ), 'color' ) )
Robert Cumming
Robert Cumming 2014년 7월 21일
My example draws a circle as an example. You would need to remove that part. You only need the last part which hides the axes, or changes the background colour.

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

Community Treasure Hunt

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

Start Hunting!

Translated by