十字利夏地区
有两种方法可以创造一个Crosshair
目的。For more information, seeCreate ROI Shapes。
使用画crosshair
功能。Use this function when you want to create the ROI and set the appearance in a single command. You can specify the position of the ROI interactively by drawing the ROI over an image using the mouse, or programmatically by using name-value arguments.
使用images.roi.Crosshair
这里描述的功能。在指定ROI的位置之前,请使用此函数在指定ROI的位置之前。创建对象后,您可以使用该对象以交互方式指定位置画
通过修改对象的属性来函数或以编程方式方式。
斧头
-投资回报员的父母gca
(默认)|一种Xes
目的|UIAxes
目的投资回报员的父母那specified as an一种Xes
对象或A.UIAxes
目的。有关在UIAXES中使用ROI的信息,包括重要限制,请参阅在使用App Designer创建的应用中使用ROIS。
颜色
-ROI颜色[0 0.4470 0.7410]
(默认)|RGB triplet|颜色名称|short color nameROI颜色,指定为RGB三联,颜色名称或短颜色名称。
您可以使用RGB三重态指定任何颜色。RGB三联网是一个3元素的行向量,其元素指定了颜色的红色,绿色和蓝色组件的强度。强度必须在范围内[0,1]。
您可以按名称指定一些常见颜色作为字符串标量或字符向量。此表列出了命名的颜色选项和等效的RGB三元组。
颜色名称 | Short Name | RGB三重态 | 外貌 |
---|---|---|---|
'红色的' |
'r' |
[1 0 0] |
|
'绿色' |
'g' |
[0 1 0] |
|
'blue' |
'B' |
[0 0 1] |
|
'青色' |
'C' |
[0 1 1] |
|
'magenta' |
'm' |
[1 0 1] |
|
'yellow' |
'是' |
[1 1 0] |
|
'黑色的' |
'k' |
[0 0 0] |
|
'白色的' |
'W' |
[1 1 1] |
|
以下是MATLAB的默认颜色的RGB三元组®在许多类型的图中使用。
RGB三重态 | 外貌 |
---|---|
[0 0.4470 0.7410] |
|
[0.8500 0.3250 0.0980] |
|
[0.9290 0.6940 0.1250] |
|
[0.4940 0.1840 0.5560] |
|
[0.4660 0.6740 0.1880] |
|
[0.3010 0.7450 0.9330] |
|
[0.6350 0.0780 0.1840] |
|
Example:'颜色','r'
Example:'颜色','绿色'
Example:'Color',[0 0.4470 0.7410]
ContextMenu
-上下文菜单ContextMenu
目的右键单击ROI时显示的上下文菜单,指定为aContextMenu
目的。You can create a custom context menu by using theuicontextmenu
功能和then configuring context menu properties.
删除
-上下文菜单提供删除ROI的选项真的
(默认)|错误的
上下文菜单provides an option to delete the ROI, specified as真的
要么错误的
。当值是真的
,您可以使用上下文菜单交互地删除ROI。当值是错误的
那the context menu option to delete the ROI is disabled.
在这两种情况下,您可以通过使用删除上下文菜单之外的ROI删除
功能。
绘图area.
-一种rea of axes in which you can interactively place ROI'汽车'
(默认)|'无限'
|[x,y,w,h]
您可以在其交互方式将ROI交互地放置的轴的区域,指定为此表中的值之一。
价值 | Description |
---|---|
'汽车' |
The drawing area is the current axes limits (default). |
'无限' |
绘图区域没有边界,可以绘制或拖动ROI延伸以超出轴限制。 |
[x,y,w,h] |
The drawing area is restricted to a rectangular region beginning at (X那y),并延伸到宽度W.和身高H。 |
Hupplvisibility.
-Visibility of ROI handle in孩子们
property of parent'在'
(默认)|'off'
|'打回来'
ROI手柄的可见性孩子们
父的属性,指定为此表中的值之一。
价值 | Description |
---|---|
'在' |
对象句柄始终可见(默认)。 |
'off' |
The object handle is hidden at all times. |
'打回来' |
The object handle is visible from within callbacks or functions invoked by callbacks, but not from within functions invoked from the command line. |
持续的
-ROI的交互性'全部'
(默认)|'没有'
ROI的交互性,指定为此表中的值之一。
价值 | Description |
---|---|
'全部' |
ROI完全互动。 |
'没有' |
ROI不互动,无可见拖动点。 |
标签
-ROI标签''
(默认)|character vector|字符串标量ROI标签那specified as a character vector or string scalar. By default, the ROI has no label (''
)。
LabelAlpha.
-文本背景的透明度1
(默认)|范围内的数字[0,1]Transparency of the text background, specified as a number in the range [0, 1]. When set to1
,文本背景完全不透明。设置到0.
,文本背景是完全透明的。
LabeltextColor.
-标签文本颜色'黑色的'
(默认)|RGB triplet|颜色名称|short color name标签文本颜色,指定为RGB三联网,颜色名称或短颜色名称。
您可以使用RGB三重态指定任何颜色。RGB三联网是一个3元素的行向量,其元素指定了颜色的红色,绿色和蓝色组件的强度。强度必须在范围内[0,1]。
您可以按名称指定一些常见颜色作为字符串标量或字符向量。此表列出了命名的颜色选项和等效的RGB三元组。
颜色名称 | Short Name | RGB三重态 | 外貌 |
---|---|---|---|
'红色的' |
'r' |
[1 0 0] |
|
'绿色' |
'g' |
[0 1 0] |
|
'blue' |
'B' |
[0 0 1] |
|
'青色' |
'C' |
[0 1 1] |
|
'magenta' |
'm' |
[1 0 1] |
|
'yellow' |
'是' |
[1 1 0] |
|
'黑色的' |
'k' |
[0 0 0] |
|
'白色的' |
'W' |
[1 1 1] |
|
以下是MATLAB在许多类型的图中使用的默认颜色的RGB三元组。
RGB三重态 | 外貌 |
---|---|
[0 0.4470 0.7410] |
|
[0.8500 0.3250 0.0980] |
|
[0.9290 0.6940 0.1250] |
|
[0.4940 0.1840 0.5560] |
|
[0.4660 0.6740 0.1880] |
|
[0.3010 0.7450 0.9330] |
|
[0.6350 0.0780 0.1840] |
|
Example:'labeltextcolor','r'
Example:'labeltextcolor','绿色'
Example:'labeltextcolor',[0 0.4470 0.7410]
标签可见
-标签可见性'在'
(默认)|'off'
|'hover'
标签可见性那specified as one of these values.
价值 | Description |
---|---|
'在' |
标签is visible when the ROI is visible. |
'hover' |
只有在鼠标在ROI上悬停时,才能看到标签。 |
'off' |
标签is not visible. |
行宽
-ROI边框的宽度ROI边框的宽度,指定为点的正数。默认值是每个屏幕像素的点数的三倍,使得边框是三个像素宽。
Parent
-ROI父母一种Xes
目的|UIAxes
目的ROI父母那specified as an一种Xes
要么UIAxes
目的。有关在UIAXES中使用ROI的信息,包括重要限制,请参阅在使用App Designer创建的应用中使用ROIS。
位置
-ROI的位置ROI的位置,指定为表格的1×2数字矢量[x y]
。The valuesX
和y
指定X- 和y- 水平线在十字线ROI中穿过垂直线的位置的控制。当您绘制或移动ROI时,此值会自动更改。
选择
-选择ion state of ROI错误的
(默认)|真的
选择ion state of the ROI, specified as the logical value真的
要么错误的
。您还可以以交互方式设置此属性。例如,单击ROI选择ROI并将此属性设置为真的
。同样,按下Ctrl键和单击ROI取消选择ROI并将此属性的值设置为错误的
。
选择色彩
-选择时ROI的颜色'没有'
(默认)|RGB triplet|颜色名称|short color name选择时,投资回报的颜色,指定为RGB三联网,颜色名称,短颜色名称或'没有'
。If you specify'没有'
,那么值颜色
为所有状态定义ROI的颜色,选择或不选择。
您可以使用RGB三重态指定任何颜色。RGB三联网是一个3元素的行向量,其元素指定了颜色的红色,绿色和蓝色组件的强度。强度必须在范围内[0,1]。
您可以按名称指定一些常见颜色作为字符串标量或字符向量。此表列出了命名的颜色选项和等效的RGB三元组。
颜色名称 | Short Name | RGB三重态 | 外貌 |
---|---|---|---|
'红色的' |
'r' |
[1 0 0] |
|
'绿色' |
'g' |
[0 1 0] |
|
'blue' |
'B' |
[0 0 1] |
|
'青色' |
'C' |
[0 1 1] |
|
'magenta' |
'm' |
[1 0 1] |
|
'yellow' |
'是' |
[1 1 0] |
|
'黑色的' |
'k' |
[0 0 0] |
|
'白色的' |
'W' |
[1 1 1] |
|
以下是MATLAB在许多类型的图中使用的默认颜色的RGB三元组。
RGB三重态 | 外貌 |
---|---|
[0 0.4470 0.7410] |
|
[0.8500 0.3250 0.0980] |
|
[0.9290 0.6940 0.1250] |
|
[0.4940 0.1840 0.5560] |
|
[0.4660 0.6740 0.1880] |
|
[0.3010 0.7450 0.9330] |
|
[0.6350 0.0780 0.1840] |
|
Example:'selectscolor','r'
Example:'selectscolor','绿色'
Example:'SELISECTCOLOR',[0 0.4470 0.7410]
条纹镜头
-颜色of ROI stripe'没有'
(默认)|RGB triplet|颜色名称|short color nameROI条带的颜色,指定为RGB三联网,颜色名称,短颜色名称或'没有'
。If you specify'没有'
,然后ROI边缘是指定的纯色颜色
。否则,ROI的边缘是条纹的,颜色在指定的颜色之间交替颜色
和条纹镜头
。
您可以使用RGB三重态指定任何颜色。RGB三联网是一个3元素的行向量,其元素指定了颜色的红色,绿色和蓝色组件的强度。强度必须在范围内[0,1]。
您可以按名称指定一些常见颜色作为字符串标量或字符向量。此表列出了命名的颜色选项和等效的RGB三元组。
颜色名称 | Short Name | RGB三重态 | 外貌 |
---|---|---|---|
'红色的' |
'r' |
[1 0 0] |
|
'绿色' |
'g' |
[0 1 0] |
|
'blue' |
'B' |
[0 0 1] |
|
'青色' |
'C' |
[0 1 1] |
|
'magenta' |
'm' |
[1 0 1] |
|
'yellow' |
'是' |
[1 1 0] |
|
'黑色的' |
'k' |
[0 0 0] |
|
'白色的' |
'W' |
[1 1 1] |
|
以下是MATLAB在许多类型的图中使用的默认颜色的RGB三元组。
RGB三重态 | 外貌 |
---|---|
[0 0.4470 0.7410] |
|
[0.8500 0.3250 0.0980] |
|
[0.9290 0.6940 0.1250] |
|
[0.4940 0.1840 0.5560] |
|
[0.4660 0.6740 0.1880] |
|
[0.3010 0.7450 0.9330] |
|
[0.6350 0.0780 0.1840] |
|
Example:'StripeColor','r'
Example:'ttimecolor','绿色'
Example:'riptecolor',[0 0.4470 0.7410]
Tag
-标签与ROI关联''
(默认)|character vector|字符串标量标记与ROI关联,指定为字符向量或字符串标量。使用标记值使用标记值查找使用的对象层次结构中的ROI对象findobj.
功能。
用户数据
-数据与ROI关联Data to associate with the ROI, specified as any MATLAB data. For example, you can specify a scalar, vector, matrix, cell array, string, character array, table, or structure. TheCrosshair
目的does not use this data.
Visible
-ROI visibility'在'
(默认)|'off'
|开/关逻辑值ROI可见性,指定为'在'
要么'off'
,或作为数字或逻辑1
(true) or0.
(false). A value of'在'
is equivalent to true, and'off'
相当于假。该值存储为类型的开/关逻辑值OnOffSwitchState
。
价值 | Description |
---|---|
'在' |
显示ROI。 |
'off' |
Hide the ROI without deleting it. You still can access the properties of an invisible ROI. |
AddListener. |
创建事件侦听器绑定到事件源 |
beginDrawingFromPoint |
Begin drawing ROI from specified point |
takttofront. |
将ROI带到轴上堆叠顺序的前面 |
画 |
以交互方式开始绘制ROI |
等待 |
BlockMATLAB指令行直到ROI操作完成 |
将图像读入工作区并显示它。
I = imread('baby.jpg');数字;imshow(i)
以编程方式在图像上放置十字参考资料。指定ROI的位置时,必须指定轴。
h = images.roi.crosshair(gca,'Position'那[100,100]);
将图像读入工作区。
img = imread('coins.png');
在图中显示图像。
H一种X= gca; imObj = imshow(img,'父母'那H一种X);imObj.Parent.Visible ='在';
Create a crosshair ROI on the image.
h = images.roi.crosshair('父母',hax,'Position',[50 50],'LineWidth'那1那'Color'那'是');
Set up a listener to get notification when the ROI moves over the image. Because the code displays the value of the pixel under the crosshair, you must pass the image as an argument to the listener.
AddListener.(h,'搬家',@(src,data)displayinfo(src,data,hax,img));
定义displayInfo
侦听器调用时的功能'搬家'
event occurs.
功能displayinfo(〜,data,hax,img)pos = ceil(data.currentposition);标题(HAX,['像素值:',num2str(IMG(POS(2),POS(1))))])结尾
外貌of the image with title during interactive movement of the Crosshair ROI.
在某些事件发生时从ROI接收通知,设置听众对于这些事件。您可以指定在发生其中一个事件时执行的回调函数。当ROI通过侦听器通知您的应用程序时,它会返回特定于事件的数据。查看特定事件的事件类以查看返回的内容。
有关使用事件侦听器的示例,请参阅创建Crosshair工具以检查像素值。
事件名称 | 扳机 | 事件数据 | 事件属性 |
---|---|---|---|
deletingroi. |
ROI is about to be interactively deleted. | event.EventData |
|
绘图了 |
ROI即将被互动地绘制。 | event.EventData |
|
绘制了 |
ROI已被互动地绘制。 | event.EventData |
|
搬运 |
ROI形状或位置正在交互地改变。 | images.roi.ROIMovingEventData |
|
Roimoved. |
ROI形状或位置已被交互地改变。 | images.roi.ROIMovingEventData |
|
roiclicked. |
ROI已被点击。 | images.roi.ROIClickedEventData |
|
使用的交互式绘制投资回报率画
要么画crosshair
功能那position the cursor over the image and click the mouse to draw the ROI.
The ROI supports the following interactivity, including keyboard shortcuts.
任务 | Description |
---|---|
取消绘图操作。 | 按退出。The function returns a valid ROI object with an empty位置 财产。 |
移动投资回报率。 | 位置the cursor over the center of the crosshair ROI (where the two lines cross) and click and drag the crosshair. Another way to move the crosshair ROI is to position the cursor anywhere on one of the two lines and click. The other line in the crosshair jumps to the new crosshair center position. |
Delete the ROI. | 将光标定位在ROI上,右键单击,然后选择Delete Crosshair从上下文菜单中。您还可以通过使用的方式删除ROI删除 功能。 |
有关在使用App Designer创建的应用程序中使用ROI的信息,请参阅在使用App Designer创建的应用中使用ROIS。
UIContextMenu.
不建议使用财产Not recommended starting in R2020a
从R2020A开始,使用UIContextMenu.
建议不要将上下文菜单分配给图形对象或UI组件的属性。使用ContextMenu
property instead. The property values are the same.
没有计划删除支持金宝appUIContextMenu.
物业此时。然而UIContextMenu.
通过调用的列表中不再出现“属性”get
在图形对象或UI组件上的功能。
You have a modified version of this example. Do you want to open this example with your edits?
您单击了与此MATLAB命令对应的链接:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
您还可以从以下列表中选择一个网站:
选择中国网站(以中文或英文)以获得最佳网站性能。其他MathWorks国家网站未优化您所在地的访问。