viscircles
创建圆圈
描述
例子
Draw Lines Around Bright and Dark Circles in Image
将图像读取到工作区中并显示。
a = imread('Circlesbrightdark.png'); imshow(A)
Define the radius range.
rmin = 30;rmax = 65;
在半径范围内找到图像中的所有明亮圆圈。
[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','黑暗的');
Draw blue lines around the edges of the bright circles.
Viscircles(centersBright, radiiBright,'颜色','b');
在黑眼圈的边缘上画红色的虚线。
Vescircles(Radiidark Centersdark,'linestyle','--');
Clear Axes Before Plotting Circles
这viscircles
函数在绘制圆圈之前不会清除目标轴。要删除以前已在轴上绘制的圆圈,请使用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.
图颜色= {'b','r','G','y','K'};fork = 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%固定轴极限。xlim([-0.1 1.1]) ylim([-0.1 1.1])% Set the axis aspect ratio to 1:1.轴正方形%设置标题。标题(['k = 'num2str(k)])%显示圆圈。Viscircles(centers,radii,'颜色',colors{k});% Pause for 1 second.pause(1)end
Input Arguments
centers
—圆心中心的坐标
two-column matrix
圆心中心的坐标,指定为P
-经过-2
矩阵,例如从imfindcircles
。这x- 圆心中心的坐标在第一列中,y- 坐标在第二列中。坐标可以是整数(任何数字类型)或浮点值(类型的浮点数)双倍的
or单身的
).
数据类型:单身的
|双倍的
|int8
|INT16
|INT32
|INT64
|UINT8
|UINT16
|UINT32
|Uint64
radii
—圆半径
column vector
圆半径,指定为列向量,例如返回imfindcircles
。这radius value atradii(j)
corresponds to the circle with center coordinatescenters(j,:)
。值radii
can be nonnegative integers (of any numeric type) or floating-point values (of type双倍的
or单身的
).
数据类型:单身的
|双倍的
|int8
|INT16
|INT32
|INT64
|UINT8
|UINT16
|UINT32
|Uint64
姓名-Value Arguments
Specify optional pairs of arguments asname1 = value1,...,namen = valuen
, 在哪里姓名
is the argument name andValue
是相应的值。名称值参数必须在其他参数之后出现,但是对的顺序并不重要。
在R2021a之前,请使用逗号分隔每个名称和值,并附上姓名
用引号。
例子:voscircles(中心,半径,'颜色','b')
指定蓝色圆边缘,使用蓝色的短颜色名称。
增强性
—Augment drawn circles with contrasting features to improve visibility
true
(默认)|false
增强绘制的圆圈具有相反的功能以提高可见性,指定为逻辑值true
orfalse
。If you set the value totrue
, thenviscircles
draws a contrasting circle below the colored circle.
数据类型:logical
Color
—边界的颜色
“红色”
(默认)|RGB三胞胎|hexadecimal color code|color name|颜色名称
Color of the boundary, specified as an RGB triplet, a hexadecimal color code, a color name, or a short color name.
For a custom color, specify an RGB triplet or a hexadecimal color code.
An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range
[0,1]
;例如,[0.4 0.6 0.7]
。十六进制的颜色代码是字符向量或字符串标量,以哈希符号开头(
#
),然后是三个或六个十六进制的数字,范围从0
至F
。这些值不敏感。因此,颜色代码'#FF8800'
,'#ff8800'
,'#F80'
, and'#f80'
are equivalent.
Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.
Color Name | 简称 | RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|---|---|
“红色” |
'r' |
[10 0] |
'#FF0000' |
|
'green' |
'G' |
[0 1 0] |
'#00FF00' |
|
'蓝色的' |
'b' |
[0 0 1] |
'#0000FF' |
|
'cyan' |
'C' |
[0 1 1] |
'#00ffff' |
|
'品红' |
'M' |
[10 1] |
'#ff00ff' |
|
'黄色' |
'y' |
[11 0] |
'#FFFF00' |
|
'黑色的' |
'K' |
[0 0 0] |
'#000000' |
|
“白色” |
'w' |
[11 1] |
'#FFFFFF' |
|
'none' |
Not applicable | Not applicable | Not applicable | 没有颜色 |
这是RGB三胞胎和默认颜色的十六进制颜色代码matlab®在许多类型的图中使用。
RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|
[0 0.4470 0.7410] |
'#0072BD' |
|
[0.8500 0.3250 0.0980] |
'#D95319' |
|
[0.9290 0.6940 0.1250] |
'#EDB120' |
|
[0.4940 0.1840 0.5560] |
'#7E2F8E' |
|
[0.4660 0.6740 0.1880] |
'#77AC30' |
|
[0.3010 0.7450 0.9330] |
'#4dbeee' |
|
[0.6350 0.0780 0.1840] |
'#A2142F' |
|
例子:voscircles(中心,半径,'颜色','r');
例子:Viscircles(centers,radii,'Color','green');
例子:voscircles(中心,半径,“颜色”,[0 0 1]);
例子:Viscircles(centers,radii,'Color','#FF8800');
线性
—Line style of circle edge
“- - -”
(默认)|'--'
|':'
|'-.'
|'none'
Line style of circle edge, specified as the comma-separated pair consisting of'linestyle'
以及下表中的任何行规范符。
Line Style | 描述 | 结果线 |
---|---|---|
“- - -” |
实线 |
|
'--' |
Dashed line |
|
':' |
Dotted line |
|
'-.' |
Dash-dotted line |
|
'none' |
没有行 | 没有行 |
LineWidth
—圆边的宽度
2
(默认)|正数
圆边的宽度,指定一个正数。线宽度以点表示,每个点等于1/72英寸。
数据类型:双倍的
输出参数
版本历史
See Also
matlab命令
You clicked a link that corresponds to this MATLAB command:
通过在MATLAB命令窗口中输入该命令。Web浏览器不支持MATLAB命令。万博1manbetx
Select a Web Site
选择一个网站以获取可用的翻译内容,并查看本地事件和优惠。根据您的位置,我们建议您选择:。
You can also select a web site from the following list:
如何获得最佳网站性能
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- AméricaLatina(Español)
- Canada(英语)
- United States(英语)