随笔 - 1762  文章 - 0  评论 - 109  阅读 - 431万

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 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

posted on   一杯明月  阅读(5910)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示