石鑫华视觉 手机微信QQ:13450001061 / 18038383457

图像编程

LabVIEW Vision之Overlay Text覆盖文本

文章来源:石鑫华视觉网时间:2022-09-05 18:11:44 点击:359

LabVIEW Vision之Overlay Text覆盖文本

本文介绍的是Overlay中的覆盖文本函数。覆盖文本功能,其作用是在图像上叠加一串字符。例如常见的测量数据、结果等都可以通过覆盖文本来实现。

image.png

Overlay Text覆盖文本函数位置

NI LabVIEW VISION中的覆盖Overlay函数位于编程>函数>视觉与运动>Vision Utilities>Overlay,其中本节介绍的Overlay Text覆盖文本函数,是第二排第四个函数IMAQ Overlay Texy。

image.png

IMAQ Overlay Text覆盖文本函数功能与接线端

覆盖文本函数,和其它覆盖函数一样,可以适用所有NI支持的图像类型,灰度图、彩色图、8位图、16位图等等,都是可以的。下面来看一下其引脚的具体说明。

Group specifies the group to which you want to add the overlay information. If no name is specified, the overlay information is added to the default group.

组:指定你想添加的覆盖信息属于哪个组。如果没有指定名称,则覆盖的信息添加到默认的组中。覆盖信息可以分组,有可能有许多的覆盖信息,所以如果有必要,则可以对相应的覆盖信息进行分组,不过一般情况下,都不使用分组功能,这里不连接使用默认值即可。

Font, Size & Style is a cluster that enables the user to choose the font, size, style, and alignment of the text. This cluster contains the following elements:

字体、大小、风格:一个包含了文本的字体、大小、风格以及对齐等选项的簇控件。这个簇包含了以下元素:

image.png

字体、大小、风格簇元素

Desired Font (Application) specifies the character type of the text. The following values are possible:

所需字体(应用程序)指定文本的字符类型。以下值是可能的:

User-specified Font (0)

用户指定字体

Specify the attributes of a font to use.   If no font is specified, the default font is used.

指定要使用的字体的属性。如果没有指定字体,则使用默认字体。

Application Font (1)

应用程序字体

(Default) Uses the LabVIEW application   font, which is the font used on the Controls and Functions palettes and on   text in new objects on the front panel or block diagram.

(默认)采用LabVIEW应用程序的字体,是控件和函数面板中使用的字体,当前面板或程序面板上的有新对象时使用文字也是此字体。

System Font (2)

系统字体

Uses the LabVIEW system font, which is   the font used in menus.

采用LabVIEW系统字体,菜单使用的字体为系统字体。

Dialog Font (3)

对话框字体

Uses the LabVIEW dialog font, which is   the font used in dialog boxes.

采用LabVIEW对话框的字体,这是对话框中使用的字体。

[User-specified Font] is a cluster containing the specific font characteristics for the text to draw. The specification is ignored unless Desired Font is set to User-specified Font.

[用户指定字体]是一个包含覆盖文本的指定字体特性的簇。当所需字体中没有指定为用户指定字体时,这个簇中的设置将被忽略不计。

Note  The Outline?, Shadow?, and Rotation Angle characteristics are not currently supported on RT targets.

注意:轮廓、阴影以及旋转角度特性当前并不支持实时系统。

Font Name is the font to use for the string.

字体指定字符串使用的字体。

Size is the size of the font in points.

大小指定字体的大小点数。

Strikeout? causes the text to appear in strikeout if TRUE.

删除线?当为真时文本中出现一条删除线。

Italic? causes the text to appear in italic if TRUE.

斜体?当为真时文本变成斜体。

Underline? causes the text to appear underlined if TRUE.

下划线?当为真时文本出现下划线。

Outline? causes the text to appear in outline if TRUE.

轮廓?当为真时出现在轮廓内。

Shadow? causes the text to appear in shadow if TRUE.

阴影?当为真时文本出现阴影。

Bold? causes the text to appear in bold if TRUE

粗体?当为真时文本变成粗体。

Rotation Angle is the orientation of the text in the image. NI Vision supports rotated text for TrueType fonts only.

旋转角度指定文本在图像中的方向。NI视觉仅支持全真字体的旋转文本。

Horizontal Alignment specifies the horizontal alignment of the text. The following values are possible:

水平对齐指定文本的水平对齐方式。以下值是可能的:

Left (0)左

(Default) Left-aligns the text.(默认)左对齐文本。

Center (1)中心

Center-aligns the text.中心对齐文本。

Right (2)右

Right-aligns the text.右对齐文本。

Vertical Alignment specifies the vertical alignment of the text. The following values are possible:

垂直对齐指定文本的垂直对齐方式。以下值是可能的:

Bottom (0)底

(Default) Aligns the text along the   bottom.(默认)底部对齐文本。

Top (1)顶

Aligns the text along the top.顶部对齐文本。

Baseline (2)基线

Aligns the text along the baseline.基本对齐文本。

 

Image is a reference to the source image.

图像:这个是图像的引用。用于连接需要覆盖的图像上。一个图像处理程序中,可能有许多的图像缓存引用,这时可能每个覆盖信息是覆盖在不同的图像上,因此要注意Image接线端连接到哪个缓存引用上。

Origin is the location on the image to overlay the text. This parameter is dependent on the values of Horizontal Alignment and Vertical Alignment.

原点:是覆盖在图像上的文本的位置(包含了X、Y两个坐标点值的簇元素)。这个参数是依赖于水平对齐和垂直对齐的。例如原点为(0,0)时,如果水平对齐为右,则看不到覆盖的字符。如果垂直对齐为底,同样看不到字符。需要保证覆盖的字体出现在图像中才可以看到。

String is the text to overlay.

字符:是需要覆盖的文本的具体内容。

Text Color (black) is the color of the text.

颜色:即覆盖文本的颜色。可以使用颜色盒直接选择。注意一点的是,覆盖的颜色使用阿尔发颜色通道的透明颜色时,是不会显示任何信息的。因此一般都不会使用透明色,这样没有什么意义。而且即使将背景色设置成非透明的,字体再设置成透明的,也仍然无法显示。

BG Color (Transparent) is the background color of the text overlay.

背景颜色(透明)是覆盖的文本的背景颜色,默认值为透明色。

Image Out is a reference to the destination image.

图像输出:已经覆盖信息后的图像引用输出。这里的图像输出,是已经覆盖了信息后的图像。因此,如果使用Image Display显示控件连接,如果连接在覆盖点函数前,则是没有覆盖的,而连接在覆盖点函数后,则是有覆盖的。当然如果在同个帧图像中进行显示,因为其时间非常快,可能看不出这种变化。

下面来看一下覆盖文本的具体效果:

image.png

覆盖文本-使用应用程序字体

使用应用程序字体时,修改用户指定字体中的参数是不管用的。除非在LabVIEW中修改系统字体的选项才有作用。

image.png

覆盖文本-使用系统字体-中心对齐

image.png

覆盖文本-使用对话框字体-右对齐-顶对齐

image.png

覆盖文本-使用对话框字体-中心对齐-基线对齐-白底蓝字

image.png

覆盖文本-使用用户指定字体

可以从中看到,字体名称、删除线、斜体、下划线、粗体、大小、旋转角度等特征都可用的,而轮廓、阴影则没有起作用。这个验证过许多的类型的字体,都不起作用。

image.png

覆盖文本-使用用户指定字体

下面再来看一下覆盖文本的程序框图:

image.png

采集图像并覆盖文本程序框图

覆盖文本功能,相对还是比较简单的。参数相对都比较好理解。一般来讲,现在的相机的分辨率都比较高,而显示器的分辨率相对比较低。而用户界面上,图像也不可能占整个屏幕。所以一般来讲,字体按照系统字体、应用程序字体、对话框字体的大小点数来显示时,都比较小。所以,对于图像中覆盖文本,一般要考虑使用用户指定字体,将字体大小设置的比较大一点。这样用户才方便直观的查看。

image.png

使用应用程序字体时字体过小看不清楚

image.png

使用用户指定字体才可以直观的看清覆盖的文本

首页
84162741QQ
联系