视觉应用

<< 点击显示目录 >>

主页  mappVision帮助助手 > 机器视觉帮助 > mapp Vision  > 配置 > 自动化组件 >

视觉应用

相机的功能在视觉应用程序中定义。AS 提供了一个可视化编辑器作为视觉应用程序文件的默认编辑器。

视觉应用程序包含图像采集配置和图像评估定义。图像采集在 "图像采集 "组中配置。图像评估通过 "输入"、"视觉功能 "和 "输出 "组进行配置。

相机的功能在视觉应用程序中定义。有哪些配置选项以及有多少配置选项取决于传感器类型。

AS 为 .visionapplication 文件提供了两种编辑器。默认编辑器是表格编辑器,但对于更复杂的文件,建议使用可视化编辑器。

配置结构

clip0035

智能传感器

如果为智能传感器创建了视觉应用程序,则可以选择一个视觉功能。视觉功能在 mapp Vision HMI 应用程序中配置,定义的参数可保存在视觉功能中。

clip0036

智能相机

可为智能相机定义多个视觉功能、常量、输入、输出等。

图像采集 - 组 "图像采集

当视觉应用程序开始运行时,将采集图像(图像采集)。获取的图像将传输至图像评估,图像评估包含一个或多个视觉功能。

图像采集类别包括影响图像的所有设置,如图像采集卡模式、图像尺寸和图像预处理功能,如滤镜、在轴上镜像图像和分选。

触发器配置和线性传感器配置也是图像采集的一部分。

有关设置选项的详细说明,请参阅图像采集配置(非循环写入)

信息:

图像采集的配置选项取决于所使用的硬件。目前在 "Vision Application Editor(视觉应用编辑器)"中没有映射。

后果

仅在构建过程中检查是否允许依赖硬件的输入值。

指定的默认值不适合视觉应用程序使用的硬件。这主要涉及图像尺寸,即图像宽度(ImageWidth)和图像高度ImageHeight)。

 

信息:

某些配置(如线性传感器)并不适用于所有图像采集卡模式。这些配置位于 "图像采集卡模式 "的子组中。

输入 "组

通过输入组,可以输入输入端的名称来定义视觉应用程序的输入端。一旦在视觉应用程序中使用了这些输入,就可以在摄像机的 I/O 接口上使用已定义的输入。

视觉功能输入可将输入用作数据源。这样,视觉功能输入端就完成了 "接线 "和配置。然后就可以直接在 I/O 接口上使用。

信息:

输入端 "继承 "其所连接的第一个视觉功能输入端的数据类型。这意味着无需手动配置数据类型。

信息:

每个视觉功能只能使用一次输入。

变量 "组

通过 "变量 "可以定义静态值,这些静态值可用作视觉功能输入的数据源。如果将变量连接到视觉功能输入端,就会进行检查,以确定变量值是否在视觉功能输入端的取值范围内。

然后用一个恒定值将视觉功能输入 "连接 "起来,这样就完成了配置。

 

信息:

变量 "继承 "其所连接的第一个视觉功能输入端的数据类型。这意味着无需手动配置数据类型。

 

信息:

每个视觉功能只能使用一个变量。

视觉功能 "组

设置

图像评估的设置可在视觉功能的 "设置 "子组中进行配置。其中包含编译器选项。

编译器选项

选项

说明

解释

直接解释图像评估代码,无需事先编译。

这是包括 mapp Vision 5.13 在内的技术软件包的唯一选项。

启动编译器

用于图像评估的即时 (JIT) 编译器。

适用于 mapp Vision 5.14 及更高版本的技术软件包。

加快了视觉功能的处理时间,但牺牲了视觉应用程序的加载时间。

信息:

根据所使用的视觉功能,可将处理时间加快 5%-100%!

更多详情,请参阅视觉功能 - 执行时间

无论是在调试期间还是通过功能块加载时,加载视觉应用程序的时间都会更长。

对于只有一个视觉功能的视觉应用,加载时间最多可延长 100 秒。

在设计用于智能相机的具有多个视觉功能的视觉应用程序中,每个视觉功能1) 的加载时间最多可增加 100 秒。

视觉功能实例

视觉功能(VF)实例配置在视觉功能组中。一个 VF 实例包含一个唯一的名称、执行编号、VF 类型、常量和输入。

VF 通过名称进行引用。

如果有多个 VF,执行编号用于定义执行顺序。

VF 的基本功能由所选的视觉功能类型决定。有关可用 VF 类型的更多信息,请参阅视觉功能。其他常量和输入取决于所选的 VF 类型。

例如,VF 常量定义了结果的最大数量,或者在 VF "读码器 "的情况下定义了字符串的最大长度。因此,常量值会影响 I/O 接口。

VF 输入是 VF 的可用输入。每个输入都需要一个有效的数据源。下表列出了可能的数据源和具体的配置选项。

数据源

说明

输入

用于视觉应用的输入。可在 I/O 接口上使用。

如果选择 "输入 "作为数据源,则可以执行第二个配置步骤,从可用的兼容输入列表中选择一个 VA 输入。要使用这种类型的 VA 输入,必须在 "输入 "组中为输入分配一个唯一的名称。

只有当输入尚未使用,或正在被具有相同数据类型和相同取值范围的 VF 输入使用时,输入才是兼容的。视觉应用输入 "继承 "第一个使用它们的 VF 输入的数据类型。

变量

视觉应用程序的变量。这些静态变量可在整个视觉应用程序中使用。

如果选择 "变量 "作为来源,则可执行第二个配置步骤,从可用的兼容变量列表中选择一个变量。要使变量可用,必须在 "变量 "组中为其分配一个唯一的名称。只有当变量尚未被使用,或正在被具有相同数据类型的 VF 输入使用时,它们才是兼容的。Vision 应用程序变量 "继承 "第一个使用它们的 VF 输入的数据类型。

如果变量被分配给 VF 输入,则会进行检查,以确定其值是否在 VF 输入的取值范围内。如果不在,则通知用户。在变量中输入新值时,也会进行同样的检查。

在构建过程中会再次检查数值,如果超出范围,则会输出构建错误信息。

视觉功能

如果在同一视觉应用程序中配置了多个视觉功能,则可将先前执行的 VF 实例的输出用作 VF 输入源。

在配置过程中,首先要选择源 VF。然后在下拉菜单 "参数 "中列出该 VF 的所有兼容输出,并选择所需的输出。

表:可用于 VF 输入的数据源

输出 "组

应在摄像机的 I/O 接口上显示的视觉应用程序输出值通过输出进行配置。输出需要一个唯一、有效的名称和数据源。只有视觉功能输出才能用作输出的数据源。首先选择 VF 实例,然后选择该 VF 实例的输出。每个 VF 输出只能在 I/O 接口上使用一次。

信息:

某些视觉功能输出可多次使用,例如结果的位置。对于这些输出,每个可能的结果都有一个单独的数据点。以输入的名称为基础,然后添加结果的索引作为扩展名。可能结果的数量受 VF 常量 "NumResultsMax "的限制。

 

信息:

必须至少配置一个有效的视觉应用输出。

一般注意事项

输入、输出、变量和视觉功能实例的名称必须唯一。建议这些名称不要以数字结尾。

信息:

每个结果都会多次应用视觉功能的特定输出。多次出现的通道的实际名称必须是唯一的。

例如将名为 "PositionYMatching "的输出连接到视觉功能实例的输出 "PositionY "上,会显示为 "PositionYMatching01"。

兼容性标准

如果视觉应用程序符合以下标准,则可视为兼容,并可在运行时交换:

兼容性标准

相同的输入/输出接口:

两个视觉应用程序的输入和输出名称必须一致。

所有视觉功能实例的输入和输出到输入和输出的接线必须与两个视觉应用程序一致。

相同的视觉功能实例:

所使用的视觉功能实例在类型、名称、执行顺序和常量方面必须与两个视觉应用程序一致。

以下设置也必须相同:

视觉函数、设置

编译器选项

图像采集

图像采集器模式

采集次数

线性传感器激活或未激活

静态或动态线条传感器模式

聚焦刻度

触发源软件或硬件

触发延迟(仅当触发源 = "软件 "时可用)

信息:

创建兼容视觉应用程序的最简单方法是在 AS 中完全配置一个应用程序,然后将其复制。应用程序中的差异是通过 mapp Vision HMI 应用程序调试造成的。

 

信息:

如果在视觉应用程序中更改了上述设置之一,则必须将视觉应用程序初始传输到摄像机。这可以通过重启控制器或摄像机来实现。

比较两个视觉程序文件

可以直接在 AS 中比较文件。为此,只需选择要比较的两个文件,然后在 <比较源文件> 下的快捷菜单中选择 <选定> 即可。

va_compare_openfilecompare

图在 AS 中比较文件

对于视觉应用程序文件,每个 VA 都必须有不同的名称,因此主节点已经不同。可以通过将第一个视觉应用程序临时重命名为与第二个视觉应用程序相同的名称来避免这种情况。

va_compare_rootnoderenamed

图主节点(视觉应用程序名称)临时命名为相同名称时的视图

使用的术语

术语

简短描述

视觉应用程序输入

在摄像机的 I/O 接口上可用的输入,前提是这些输入具有有效的名称并且正在使用。非 "有线 "的视觉应用输入在 I/O 接口上不可用。

视觉应用输出

应在摄像机 I/O 接口上使用的输出必须定义为视觉应用输出。输出需要一个名称以及对 VF 实例和 VF 输出的引用。

视觉功能 (VF)

预编程的图像评估功能,可通过输入、参数和模型针对特定用例进行定制。

执行编号

决定逐个执行视觉功能的顺序。在表格编辑器中,列表顺序与执行顺序相对应。可以通过在表格编辑器中上下移动 VF 来更改顺序。

VF 类型

所选的视觉功能类型定义了 VF 的基本功能。可通过输入、参数和模型对其进行指定,并使其适合特定的使用情况。

有关可用视觉功能类型的更多信息,请参阅视觉功能

VF 常量

哪些 VF 常量可用取决于所选的 VF。例如,这些常量用于定义 VF 实例可返回结果的最大数量。这些常量的值无法在运行时修改。

VF 输入

视觉功能的可配置输入。每个输入都需要一个有效的数据源。视觉应用输入可用作数据源。

如果在同一个视觉应用程序中配置了多个视觉功能,先前执行的视觉功能的输出也可用作数据源。

VF 输出

视觉功能的输出。VF 输出可用作视觉应用输出或稍后执行的 VF 的数据源。

视觉应用变量

具有静态值的变量,可在整个视觉应用中使用。

表:视觉应用中使用的术语

使用术语

视觉功能(VF):预编程图像评估功能,可通过输入、参数和模型针对特定用例进行定制。

执行顺序:视觉功能的执行顺序。在表格编辑器中,列表顺序与执行顺序相对应。可以通过在表格编辑器中上下移动 VF 来更改顺序。执行索引指定 VF 在序列中的位置。

视觉应用变量:具有静态值的变量,可在整个视觉应用程序中使用。

视觉应用输入:可在摄像机 I/O 接口上使用的输入,前提是这些输入具有有效名称并正在使用。非 "有线 "的视觉应用输入在 I/O 接口上不可用。

视觉应用输出:应在 I/O 摄像头接口上使用的输出必须定义为视觉程序输出,并带有名称、VF 引用和参数。

VF 常量:视觉功能实例中的常量。哪些常量可用取决于视觉功能的类型。例如,这些常量用于定义该视觉功能可返回结果的最大数量,或确定是否应提供有关结果的附加信息。

常量的值只能在 AS 中修改,因为它们会影响 I/O 接口的结构。

VF 类型:所选的视觉功能类型定义了 VF 的基本功能。可通过参数对其进行指定,并使其适应特定的使用情况。

有关可用视觉功能类型的更多信息,请参阅此处

VF 输入:视觉功能的输入参数。每个输入参数都需要一个有效的数据源。输入、变量和局部变量均可用作数据源。

如果在同一视觉应用程序中配置了多个视觉功能,则先前执行的视觉功能的输出也可用作数据源。

1) 启动编译器选项导致的加载时间延长与是否使用一个或多个视觉功能类型实例无关。


The functionality of the camera is defined in the vision application. Automation Studio provides a visual editor as the default editor for vision application files.

A vision application contains the image acquisition configuration and image evaluation definition. Image acquisition is configured in group "Image acquisition". Image evaluation is configured via groups "Inputs", "Vision functions" and "Outputs".

The functionality of the camera is defined in the vision application. Which and how many configuration options are available depends on the sensor type.

Automation Studio provides two editors for .visionapplication files. The default editor is a table editor, but using the visual editor is recommended for more complex files.

Configuration structure

clip0035

Smart Sensor

If a vision application for a Smart Sensor is created, it is possible to select exactly one vision function. The vision function is configured in the mapp Vision HMI application, and defined parameters can be saved in the vision

clip0036

Smart Camera

Multiple vision functions, constants, inputs, outputs, etc. can be defined for Smart Cameras.

Image acquisition - Group "Image acquisition"

An image is acquired (image acquisition) when a vision application starts running. The acquired image is transferred to image evaluation, which contains one or more vision functions.

Category Image acquisition includes all settings that influence the image, such as frame grabber mode, image size and image pre-processing functions such as filters, mirroring the image on an axis and binning.

The trigger configuration and configuration of the line sensor are also part of image acquisition.

For detailed descriptions of the setting options, see Image acquisition configuration (acyclic write)

Information:

The configuration options for image acquisition depend on the hardware used. This is not currently mapped in the Vision Application Editor.

Consequences:

The permissibility of hardware-dependent input values is only checked during build.

The specified default values are not adapted to the hardware used by the vision application. This primarily concerns the image size, i.e ImageWidth and ImageHeight.

Information:

Certain configurations, such as the line sensor, are not available for all frame grabber modes. These are located in subgroups of "Frame grabber mode".

Group "Inputs"

With Inputs, the inputs of the vision application are defined by entering a name for the input. As soon as they are used in the vision application, the defined inputs will be available on the camera's I/O interface.

An input can be used as a data source by a vision function input. The vision function input is then "wired" and thus fully configured. It can then be used directly on the I/O interface.

Information:

An input "inherits" the data type of the first vision function input it is connected to. This means that the data type does not need to be manually configured.

Information:

An input can only be used once per vision function.

Group "Variables"

With Variables, static values can be defined that can be used as a data source by vision function inputs. If a variable is connected to a vision function input, a check is carried out to determine whether the value of the variable is within the range of values for the vision function input.

The vision function input is then "wired" with a constant value and thus fully configured.

Information:

A variable "inherits" the data type of the first vision function input it is connected to. This means that the data type does not need to be manually configured.

Information:

A variable can only be used once per vision function.

Group "Vision functions"

Settings

Settings for image evaluation can be configured in subgroup "Settings" of the vision functions. These contain the compiler options.

Compiler options

Option

Description

Interpreted

The code for image evaluation is interpreted directly without having to be compiled beforehand.

This is the only option for Technology Packages up to and including mapp Vision 5.13.

Startup compiler

Just-in-time (JIT) compiler for image evaluation.

Option for Technology Packages in mapp Vision 5.14 and later.

Speeds up the processing time of vision functions at the expense of the loading time of the vision application.

Information:

Depending on the vision function used, this results in acceleration of the processing time by 5% to 100%!

For additional details, see Vision functions - Execution times.

Loading the vision application can take longer, both during commissioning and when loading via function block.

For a vision application with only one vision function, the loading time can increase by up to 100 seconds.

In a vision application with multiple vision functions that is designed for use on a vision Smart Camera, the loading time can increase by up to 100 seconds per vision function1) used.

Vision function instances

Vision function (VF) instances are configured in group Vision functions. A VF instance contains a unique name, execution number, VF type, constants and inputs.

The VF is referenced via the name.

The execution number is used to define the order of execution if there are multiple VFs.

The basic functionality of the VF is determined by the selected vision function type. For additional information about available VF types, see Vision functions. Other constants and inputs are available depending on the selected VF type.

The VF constants define the maximum number of results, for example, or the maximum string length in the case of VF "Code reader". As a result, the values of the constants affect the I/O interface.

The VF inputs are the available inputs for the VF. Each input needs a valid data source. The possible data sources and specific configuration options are listed in the table below.

Data source

Description

Input

Inputs for the vision application. These are available on the I/O interface.

If "Input" is selected as a source, a second configuration step can be carried out in which a VA input is selected from the list of available, compatible inputs. For this type of VA input to be available, a unique name must have been assigned to the input in group "Inputs".

Inputs are only compatible if they are not yet being used, or if they are being used by VF inputs with the same data type and same range of values. Vision application inputs "inherit" the data type of the first VF input that uses them.

Variable

Variables of the vision application. These static variables can be used in the entire vision application.

If "Variable" is selected as a source, a second configuration step can be carried out in which a variable is selected from the list of available, compatible variables. For a variable to be available, a unique name must have been assigned to it in group "Variables". Variables are only compatible if they are not yet being used, or if they are being used by VF inputs with the same data type. Vision application variables "inherit" the data type of the first VF input that uses them.

If a variable is assigned to a VF input, a check is carried out to determine whether its value is within the range of values for the VF input. If this is not the case, the user is notified. The same check is carried out when a new value is entered in the variable.

The values are checked again during build, and a build error is output in the event of range violations.

Vision function

If there are multiple vision functions configured in the same vision application, outputs from a previously executed VF instance can be used as a VF input source.

During configuration, the source VF is selected first. All compatible outputs for this VF are then listed in drop-down menu "Parameter" and the desired output can be selected.

Table: Data sources available for VF inputs

Group "Outputs"

The vision application output values that should be visible on the camera's I/O interface are configured with Outputs. An output needs a unique, valid name and a data source. Only vision function outputs can be used as a data source for an output. The VF instance is selected first, then an output of this VF instance. Each VF output can only be available on the I/O interface once.

Information:

Certain vision function outputs are available more than once, such as the position of a result. For these outputs, a separate data point is available for each possible result. The entered name is used as the basis, and the index of the result is then added as an extension. The number of possible results is limited by VF constant "NumResultsMax".

Information:

At least one valid vision application output must be configured.

General notices

The names of inputs, outputs, variables and vision function instances must be unique. It is recommended that these names do not end in digits.

Information:

Outputs specific to a vision function are applied several times per result. The actual names available for the channels that occur multiple times must be unique.

Example: An output named "PositionYMatching" wired to output "PositionY" of a vision function instance appears as "PositionYMatching01".

Compatibility criteria

Vision applications are considered compatible and can be exchanged at runtime if they meet the following criteria:

Compatibility criteria

Same I/O interface:

The names of the inputs and outputs must match for both vision applications.

The wiring of the inputs and outputs of all vision function instances to inputs and outputs must match for both vision applications.

Same vision function instances:

The vision function instances used must match in type, name, order of execution and constants for both vision applications.

The following settings must also be identical:

Vision functions, settings

Compiler option

Image acquisition

Frame grabber mode

Acquisition count

Line sensor active or not active

LinesensorMode static or dynamic

FocusScale

TriggerSource software or hardware

TriggerDelay (only available if TriggerSource = "Software")

Information:

The easiest way to create compatible vision applications is to configure one completely in Automation Studio and then copy it. Differences in the application result from commissioning via the mapp Vision HMI application.

Information:

If one of the settings above is changed in a vision application, an initial transfer of the vision application to the camera is necessary. This is achieved by restarting the controller or the camera.

Comparing two vision application files

Files can be compared directly in Automation Studio. To do this, the two files to be compared are simply selected and then <Selected> is selected in the shortcut menu under <Compare source files>.

va_compare_openfilecompare

Fig.: Comparing files in Automation Studio

For vision application files, where each VA must have a different name, the main node is already different. This can be circumvented by temporarily renaming the first vision application to the same name as the second vision application.

va_compare_rootnoderenamed

Fig.: View if the main node (vision application name) is temporarily named the same

Terms used

Term

Short description

Vision application inputs

Inputs that are available on the camera's I/O interface, provided that they have a valid name and are being used. Vision application inputs that are not "wired" are not available on the I/O interface.

Vision application outputs

Outputs that should be available on the camera's I/O interface must be defined as vision application outputs. An output needs a name and a reference to the VF instance and VF output.

Vision function (VF)

Pre-programmed image evaluation function that can be customized for a particular use case via inputs, parameters and models.

Execution number

Determines the order in which vision functions are executed one after the other. In the table editor, the listing order corresponds to the order of execution. The order can be changed by moving a VF up or down in the table editor.

VF type

The selected vision function type defines the basic functionality of the VF. It can be specified via inputs, parameters and models and adapted to a particular use case.

For additional information about available vision function types, see Vision functions.

VF constants

Which VF constants are available depends on the selected VF. These constants are used, for example, to define the maximum number of results this instance of the VF can return. The value of these constants can no longer be modified at runtime.

VF inputs

The configurable inputs of the vision function. Each of these inputs needs a valid data source. Vision application inputs can be used as a source.

If more than one vision function is configured in the same vision application, outputs from previously executed vision functions can also be used as a source.

VF outputs

The outputs of the vision function. The VF outputs can be used as a data source for vision application outputs or for VFs that are executed later.

Vision application variables

Variables with a static value that can be used throughout the entire vision application.

Table: Terms used in the context of the vision application

Terms used

Vision function (VF): Pre-programmed image evaluation function that can be customized for a particular use case via inputs, parameters and models.

Execution order: Order in which the vision functions are executed. In the table editor, the listing order corresponds to the order of execution. The order can be changed by moving a VF up or down in the table editor. The execution index specifies where a VF is located in the sequence.

Vision application variables: Variables with a static value that can be used throughout the entire vision application.

Vision application inputs: Inputs that are available on the camera's I/O interface, provided that they have a valid name and are being used. Vision application inputs that are not "wired" are not available on the I/O interface.

Vision application outputs: Outputs that should be available on the I/O camera interface must be defined as vision program outputs with a name and reference to the VF and parameter.

VF constants: The constants in the vision function instance. Which constants are available depends on the type of vision function. These constants are used, for example, to define the maximum number of results this vision function can return or to determine whether additional information regarding the results should be available.

The value of constants can only be modified in Automation Studio because they affect the structure of the I/O interface.

VF type: The selected vision function type defines the basic functionality of the VF. It can be specified via parameters and adapted to a particular use case.

For additional information about available vision function types, see here.

VF inputs: The input parameters of the vision function. Each of these input parameters needs a valid data source. Inputs, variables and local variables can be used as a source.

If more than one vision function is configured in the same vision application, outputs from previously executed vision functions can also be used as a source.

1) The longer loading time, caused by the startup compiler option, is independent of whether one or more instances of a vision function type are used.