• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

matlab之viscircles()函数

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

函数功能:画圆

语法:

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 5 random 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 1 second.
    pause(1)
end

 

 

 

 

 

 

 

 

 

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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
delphi出现unable to locate file'Dialogs.pas' 等的解决方法发布时间:2022-07-18
下一篇:
delphi怎样在关闭程序时弹出窗口?发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap