matlab中circle函数_matlab之viscircles()函数

函数功能:画圆

语法:

viscircles(centers,radii)

viscircles(ax,centers,radii)

viscircles(___,Name,Value)

h = viscircles(___)

描述:

viscircles(centers,radii) draws circles with specified centers and radii onto the current axes.

viscircles(centers,radii) 将具有指定中心和半径的圆绘制到当前轴上。

举例:

1.read the image into the workspace and display it.

将图像读入工作区并进行显示。

A = imread('circlesBrightDark.png');

imshow(A)

define the radius range.

定义半径范围。

Rmin = 30;

Rmax= 65;

find all the bright circles in the image within the radius range.

在定义的半径范围内找到图像中所有明亮的圆圈。

[centersBright, radiiBright] = imfindcircles(A,[Rmin Rmax],'ObjectPolarity','bright');

find all the dark circles in the image within the radius range.

在定义的半径范围内找到图像中的所有暗眼圈。

[centersDark, radiiDark] = imfindcircles(A,[Rmin Rmax],'ObjectPolarity','dark');

draw red lines around the edges of the bright circles.

在明亮的圆圈边缘画一条红线。

viscircles(centersBright, radiiBright,'Color','r');

draw red dashed lines around the edges of the dark circles.

围绕暗圆的边缘绘制红色虚线。

viscircles(centersDark, radiiDark,'LineStyle','--');

2.viscircles(ax,centers,radii) draws circles onto the axes specified by ax.

viscircles(ax,centers,radii) 把圆画到指定的轴上。

举例:

the viscircles function does not clear the target axes before plotting circles. to remove circles that have been previously plotted in an axes, use the cla function. to illustrate, this example creates a new figure and then loops, drawing a set of circles with each iteration, clearing the axes each time.

在绘制圆之前,viscircles不去除目标轴。若要删除以前在轴中绘制的圆圈,请使用CLA函数。为了举例说明,这个示例创建一个新的图形,然后循环,用每次迭代绘制一组圆圈,每次清除轴。

figure

colors= {'b','r','g','y','k'}; %for k = 1:5

% Create 5random circles to display,

X= rand(5,1);

Y= rand(5,1);

centers=[X Y];

radii= 0.1*rand(5,1);%Clear the axes.

cla%Fix the axis limits.

xlim([-0.1 1.1])

ylim([-0.1 1.1])% Set the axis aspect ratio to 1:1.

axis square%Set a title.

title(['k ='num2str(k)])%Display the circles.

viscircles(centers,radii,'Color',colors{k});% Pause for 1second.

pause(1)

end

https://ww2.mathworks.cn/help/images/ref/viscircles.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值