测量配置(非循环写入)

<< 点击显示目录 >>

主页  mappVision帮助助手 > 机器视觉帮助 > mapp Vision  > 编程 > 视觉功能 > 测量 >

测量配置(非循环写入)

信息:

本节介绍 MVTec 的 HALCON 22.11 机器视觉软件库中包含的参数。

 

信息:

这些参数可直接在 mapp Vision HMI 应用程序中更改(参见配置视觉功能)。

 

信息:

决定 POWERLINK 帧长度的单个配置参数只能在 AS 软件的配置过程中更改(即循环更改)。因此,这些参数只能在运行时读取,并标识为常量。

参数

类型

取值范围

说明

循环

非循环

常量

最大结果数

USINT

1 至 255

搜索对象的最大数量

 

R/W1

模型参数

类型

字符串

边缘模型模式 0

边缘模型模式 1

圆形模型

模型类型

 

R/W

 

 

 

 

 

 

西格玛

USINT

0.4 至 100

平滑参数(用于边缘检测)

默认值 = 1.0

 

R/W

边缘对比度

USINT

1 至 255

边缘检测阈值

默认值 = 30

 

R/W

过渡

USINT

0 至 3

边缘过渡

0 = 正(从暗到亮)(默认值)

1 = 负(从亮到暗)

2 = 全部

3 = 均匀

 

R/W

选择

USINT

0 至 2

选择边缘(与所选 ROI 方向有关,圆从外到内)

0 = 第一个(默认值)

1 = 最后

2 = 全部

 

R/W

边缘长度公差

 

0.0 至 26224.0

仅适用于检测模式为 0 的边缘模型

默认值:5.0

 

R/W

方向公差

 

0 至 45

仅适用于检测模式为 0 的边缘模型

默认值:45

 

R/W

半径公差

 

0.0 至 26224.0

仅适用于圆模型

默认值:5.0

 

R/W

完整性

 

0.0 至 1.0

仅适用于圆形模型(检测模式无关紧要)和检测模式为 1 的边缘模型

默认值:1.0

 

R/W

搜索角度

 

-179.99 至 180.0

仅适用于边缘模型

默认值:0.0

 

R/W

测量参数

操作

字符串

2 个模型:

正交距离

角度

距离

距离最小值

最大距离

交点_x

交叉点_y

1 个模型:

长度

方向

位置_x

位置_y

从现有列表中选择可用的测量操作

 

W

模型参考

USINT

1 至 255

第一个操作数的型号

 

W

模型目标

USINT

0 至 255

第二个操作数的型号。未找到,因此在只有一个操作数的测量中为 0。

 

W

1

配置参数在运行时保持不变,此时仅为 "读取"。

常数

最大结果数

运行时不可修改的变量。仅在 AS 软件上下文中需要使用。保留内存块的最大数量。

类型

选择测量目标的类型(形状)。

数据类型

信息

字符串

边缘模型模式 0

边缘(可变)

可变边缘检测。相关参数:除半径公差、完整性外的所有参数。在 ROI 内进行边缘检测,选择潜在的边缘候选对象(角度范围方向 SearchAngle +/-45°,最小长度为 5 像素),对所有候选对象进行形状拟合,根据位置或长度、推导长度、方向结果选择合适的候选对象,同时考虑上述参数。

边缘模型模式 1

边缘(受限)

精确检测边缘,但位置有限。相关参数:除边缘长度公差、方向公差、半径公差外的所有参数。按顺序对每个候选对象进行形状拟合(以 MetrologyModel 为基础),推导测量点数量,测量矩形,其中 ROI 区域为 MetrologyModel 所定义(周围最小的矩形,有方向),结果为考虑上述参数后的第一个合适候选对象。

圆形模型

检测圆形。相关参数:除边缘长度公差、方向公差、完整性、搜索角度外的所有参数。在 ROI 范围内进行边缘检测,选择潜在的候选圆,按长度排序,按顺序对每个候选圆进行形状拟合(以 MetrologyModel 为基础),推导参考位置、半径、角度范围边缘(以及自动确定测量点数量、测量矩形和完整性),结果是考虑到上述参数的第一个合适候选圆。

西格玛

用于边缘检测的平滑参数。

参数 "Sigma "指定了用于平滑图像灰度值的标准偏差(高斯函数)。

边缘对比度

定义边缘检测的阈值(灰度级)。

过渡

定义边缘过渡类型。

对于正/负边缘,过渡方向为 SearchAngle。对于从中心向外观察的圆。如果使用 "Uniform(均匀)",则只使用一种或另一种过渡的边缘来搜索实例,而不会同时使用两种过渡。如果使用 "全部",则会使用所有边缘,甚至是混合边缘。

选择

选择边缘(与所选的 ROI 方向有关,圆从外到内)

参数值决定边缘端点的选择。对于 EdgeModel:DetectionMode = 1 和 CircleModel 时,这一选择意味着只有合适的边缘才会被用于拟合,即所有其他边缘都会被舍弃。因此,这并不是直接对潜在结果进行选择。而在边缘检测(EdgeModel: DetectionMode = 0)中,则是直接从搜索角度(SearchAngle)找到的边缘中进行选择。这里,值 "全部 "表示选择最长的边。

检测模式

模式 1 只适用于边(不适用于圆),允许使用 Execute 非常快速但更有限地搜索边。Execute 也会相应地考虑其他模型参数。

边缘长度容差

执行 "时的边长容差。参考值是教学过程中的边缘长度。

方向公差

执行 "的边缘方向公差。参考是教学过程中的边的方向。

半径公差

圆搜索过程中的半径公差。参考值为示教过程中的边缘半径。最大值自动受限于示教过程中的圆半径。

参数 RadiusTolerance 的单位是像素。该值决定了圆边缘位置相对于模型定义的参考半径(通过示教过程)的最大变化。

示例下面的灰色圆是通过示教过程找到的。

vf_measurement_radiustolerance

绘制的矩形的径向范围与 2*RadiusTolerance 相对应。在这些矩形中搜索符合配置的相应边缘位置。找到的边缘位置将用于搜索候选圆。

值得注意的是,在视觉功能中,半径公差值会自动使用,最小为 1 像素,最大为模型半径。如果输入的值超出范围,则会相应使用最小值(1)或最大值(模型圆半径)。

完整性

搜索到的模型边缘相对于教学过程中的参考的完整性。

仅适用于 EdgeModel:DetectionMode = 1。搜索到的模型边缘相对于教学过程参考的完整性。该参数可以实现更稳健的边缘检测。该值规定了在边缘上允许检测的边缘灰度值中断的百分比。

搜索角度

与边缘查找相关的 ROI 对齐方式。

该参数根据参数 "Sigma"(西格玛)、EdgeContrast(边缘对比度)、"Transition"(过渡)和 "Select"(选择)确定边缘检测的方向。该参数仅适用于 EdgeModel。

操作

选择所需的测量操作。可配置的测量次数受NumResultsMax 的值限制。

数据类型

信息

字符串

正交距离

正交距离

角度

两条直线之间的角度。

正交距离

两条直线的几何中心之间的距离

最小距离

两条直线之间的最小距离

最大距离

两条直线之间的最大距离

交叉点_x

两条直线交点的 X 位置。

交点_y

两条直线交点的 Y 位置。

长度

直线或(部分)圆的长度

方向

直线的对齐角度

位置_x

直线中心点或圆中心点的 X 坐标

位置_y

直线中心点或圆中心点的 X 坐标

信息:

有关可能的测量操作概述,请参阅测量 - 操作

模型参考

测量第一操作数的型号。

数据类型

信息

USINT

1 至 255

第一个操作数的型号。

目标型号

测量的第二个操作数的型号。

数据类型

信息

USINT

0 至 255

第二个操作数的型号。未找到,因此对于只有一个操作数的测量值为 0。


Information:

This section describes the included parameters from the HALCON 22.11 machine vision software library from MVTec.

 

Information:

These parameters can be changed directly in the mapp Vision HMI application (see Configuring vision functions).

 

Information:

Individual configuration parameters that determine the length of a POWERLINK frame can only be changed during configuration in Automation Studio (i.e. acyclically). These parameters can therefore only be read at runtime and are identified as constants.

Parameters

Type

Range of values

Description

Cyclic

Acyclic

Constants

NumResultsMax

USINT

1 to 255

Maximum number of objects to search

 

R/W1

Model parameters

Type

STRING

Edge model mode 0

Edge model mode 1

Circle model

Model type

 

R/W

 

 

 

 

 

 

Sigma

USINT

0.4 to 100

Smoothing parameters (for edge detection)

Default value = 1.0

 

R/W

EdgeContrast

USINT

1 to 255

Threshold value for edge detection

Default value = 30

 

R/W

Transition

USINT

0 to 3

Edge transition

0 = Positive (dark to light) (default value)

1 = Negative (light to dark)

2 = All

3 = Uniform

 

R/W

Select

USINT

0 to 2

Selects the edge (in relation to the selected direction of the ROI, from the outside to the inside for a circle)

0 = First (default value)

1 = Last

2 = All

 

R/W

EdgeLengthTolerance

 

0.0 to 26224.0

Only relevant for edge_model with DetectionMode 0

Default: 5.0

 

R/W

OrientationTolerance

 

0 to 45

Only relevant for edge_model with DetectionMode 0

Default: 45°

 

R/W

RadiusTolerance

 

0.0 to 26224.0

Only relevant for circle_model

Default: 5.0

 

R/W

Completeness

 

0.0 to 1.0

Only relevant for circle_model (DetectionMode does not matter) and edge_mode with DetectionMode 1

Default: 1.0

 

R/W

SearchAngle

 

-179.99 to 180.0

Only relevant for edge_model

Default: 0.0

 

R/W

Measurement parameters

Operation

STRING

2 models:

orthogonal_distance

angle

distance_cog

distance_min

distance_max

intersection_x

intersection_y

1 model:

length

orientation

position_x

position_y

Selects available measuring operation from the existing list

 

W

ModelReference

USINT

1 to 255

Model numbers of the 1st operand

 

W

ModelTarget

USINT

0 to 255

Model numbers of the 2nd operand. Not found and therefore 0 for measurements with only one operand.

 

W

1

The configuration parameter is constant at runtime and in this case only "Read".

Constants

NumResultsMax

Variable that cannot be modified at runtime. Only necessary in the Automation Studio context. Reserves the maximum number of memory blocks.

Type

Selects the type (shape) of measurement target.

Data type

Values

Information

STRING

Edge model mode 0

Edge (variable)

Variable detection of edges. Relevant parameters: All except RadiusTolerance, Completeness. Edge detection within ROI selection for potential edge candidates (angle range orientation SearchAngle +/-45°, minimum length of 5 pixels) shape fitting for all candidates, selection by location or length, derivation length, orientation result is suitable candidate when taking the parameters above into account.

Edge model mode 1

Edge (restricted)

Accurate detection of the edge but limited in position. Relevant parameters: All except EdgeLengthTolerance, OrientationTolerance, RadiusTolerance. Shape fitting per candidate in sequence (MetrologyModel basis), derivation number of measuring points, measuring rectangles, where ROI area is defined for MetrologyModel (smallest surrounding rectangle, oriented), result is first suitable candidate when taking the parameters above into account.

Circle model

Circle

Detection of circles. Relevant parameters: All except EdgeLengthTolerance, OrientationTolerance, Completeness, SearchAngle. Edge detection within ROI selection for potential circle candidates, sorting by length, shape fitting per candidate in sequence (MetrologyModel basis), derivation reference position, radius, angular range edge (as well as automatic determination of number of measuring points, measuring rectangles and completeness), result is first suitable candidate when taking the parameters above into account.

Sigma

Smoothing parameters for edge detection.

Parameter "Sigma" specifies a standard deviation (Gaussian function) for smoothing the grayscale values in the image.

EdgeContrast

Defines threshold value (of shades of gray) for edge detection.

Transition

Defines the type of edge transition.

For positive/negative, the transition is in the direction of SearchAngle. For circles viewed from the center outward. With "Uniform", only edges of one or the other transition are used to search for instances, but not both. All edges are used with "All", even mixed.

Select

Selects the edge (in relation to the selected direction of the ROI, from the outside to the inside for a circle)

The value of the parameter determines the selection of the edge's end points. For EdgeModel: DetectionMode = 1 and CircleModel, this choice means that only appropriate edges are used for fitting, i.e. all others are discarded. It is therefore not directly a selection of potential outcomes. With edge detection (EdgeModel: DetectionMode = 0), however, selection is made directly from the edges found with respect to SearchAngle. Here, value "all" means that the longest edge is selected.

DetectionMode

Mode 1 is only available for edges (not circles) and allows a very fast but more limited search for edges with Execute. Execute also takes other model parameters into account accordingly.

EdgeLengthTolerance

Tolerance of the length of edges for "Execute". The reference is the length of the edge from the teach-in process.

OrientationTolerance

Tolerance of the orientation of edges for "Execute". The reference is the orientation of the edge from the teach-in process.

RadiusTolerance

Tolerance of the radius during the circle search. Reference is the radius of the edge from the teach-in process. The maximum is automatically limited by the radius of the circle from the teach-in process.

The unit of parameter RadiusTolerance is pixels. The value determines the desired maximum variation of the edge position of a circle with respect to the reference radius defined by the model (by the teach-in process).

Example: The following gray circle is found by the teach-in process.

vf_measurement_radiustolerance

The radial extent of the drawn rectangles corresponds to 2*RadiusTolerance. Corresponding edge positions that match the configuration are searched for in these rectangles. The found positions of the edges are then used to search for the circle candidate.

It is important to note that in the vision function, the value for RadiusTolerance is automatically used with a minimum of 1 pixel and a maximum of the radius of the model. If the entered value is outside the range, the minimum (1) or maximum (radius model circle) is used accordingly.

Completeness

Completeness of the edges of the searched model with respect to the reference from the teach-in process.

Only possible for EdgeModel: DetectionMode = 1. Completeness of the edges of the searched model with respect to reference from the teach-in process. This parameter allows for a more robust edge detection. The value specifies to what percent the edge is permitted to detect without grayscale value interruptions on an edge.

SearchAngle

Alignment of the ROI, relevant for edge finding.

This parameter determines the direction where the edge is detected based on parameters "Sigma", EdgeContrast, "Transition" and "Select". This parameter is only relevant for EdgeModel.

Operation

Selects the desired measuring operation. The number of configurable measurements is limited by the value of NumResultsMax.

Data type

Values

Information

STRING

orthogonal_distance

The orthogonal distance

angle

The angle between two lines.

distance_cog

Distance between the geometric centers of two lines

distance_min

Minimum distance between two lines

distance_max

Maximum distance between two lines

intersection_x

X position of the intersection of two straight lines.

intersection_y

Y position of the intersection of two straight lines.

length

Length of the line or (partial) circle

orientation

Alignment angle of the line

position_x

X-coordinate of the center point of the line or center point of the circle

position_y

X-coordinate of the center point of the line or center point of the circle

Information:

For an overview of the possible measuring operations, see Measurement - Operation.

ModelReference

Model numbers of the 1st operand of the measurement.

Data type

Values

Information

USINT

1 to 255

Model number of the 1st operand.

ModelTarget

Model numbers of the 2nd operand of the measurement.

Data type

Values

Information

USINT

0 to 255

Model number of the 2nd operand. Not found and therefore 0 for measurements with only one operand.