机器视觉 set_fuzzy_measure_norm_pair算子
Posted 沧海一笑-dj
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了机器视觉 set_fuzzy_measure_norm_pair算子相关的知识,希望对你有一定的参考价值。
00. 目录
01. 概述
set_fuzzy_measure_norm_pair - 为边缘对指定一个归一化的模糊函数。
02. 签名
set_fuzzy_measure_norm_pair( : : MeasureHandle, PairSize, SetType, Function : )
03. 描述
set_fuzzy_measure_norm_pair指定在Function中传递归一化模糊函数。 指定的模糊函数使得fuzzy_measure_pos,fuzzy_measure_pairs和fuzzy_measure_pairing能够评估和选择检测到的边缘和边缘对的候选。 为此,不同边缘特征的加权特征可以由一个函数来定义。 这种特定的特征被称为模糊集合。 指定模糊集没有功能意味着不使用此特征进行最终边缘评估。 将第二个模糊函数设置为模糊集意味着丢弃第一个定义的函数并将其替换为第二个函数。 与set_fuzzy_measure不同,这些函数的横坐标x必须相对于边缘对的期望尺寸s(在PairSize中传递)来定义。 这使得所定义的功能得到广泛使用。 先前定义的归一化模糊函数可以通过reset_fuzzy_measure完全丢弃。
可以定义由SetType参数选择的三种不同模糊集合类型的函数,一个集合的子类型是互斥的:
'size’表示一个模糊集合,以像素为单位评估一对的两个边缘的归一化距离:
通过以模糊值0.0终止函数来指定尺寸的上限x_max将加快fuzzy_measure_pairs / fuzzy_measure_pairing,因为不必考虑所有可能的配对。 此外,这个模糊集也可以通过’size_diff’指定为归一化的大小差异
和“size_abs_diff”的绝对归一化大小差异
'position’的模糊函数评估由gen_measure_arc或gen_measure_rectangle2生成的每个候选边缘到measure对象的参考点的有符号距离p:
参考点位于开始处,而’position_center’或’position_end’将参考点设置为一维灰度值轮廓的中间或末端。 如果模糊位置评估取决于沿着轮廓’position_first_edge’的对象的位置,则’position_last_edge’在第一个/最后提取的边缘的位置处设置参考点。 当提取边缘对时,边缘对的位置被两边的模糊位置分数的几何平均值所引用。
与‘postition’相似,‘position_pair’计算每个边缘对与测量对象参考点的有符号距离。 边缘对的位置由两个边缘之间的中心点定义。 对象的引用可以分别由’position_pair_center’,‘position_pair_end’和’position_first_pair’,'position_last_pair’来设置。 与’position’相反,该模糊集仅由fuzzy_measure_pairs / fuzzy_measure_pairing使用。
归一化的模糊函数被定义为至少两对值的分段线性函数,按x值升序排序。 模糊函数的y值表示相应特征值的权重,并且必须满足0.0 <= y <= 1.0的范围。 在由最小和最大x值定义的函数间隔之外,间隔边界的y值不断连续。 这样的模糊函数可以由create_funct_1d_pairs生成。
如果定义了多个集合,则fuzzy_measure_pos / fuzzy_measure_pairs / fuzzy_measure_pairing通过每个集合的权重的几何平均值来产生整体模糊加权。
原文描述:
set_fuzzy_measure_norm_pair specifies a normalized fuzzy function passed in Function. The specified fuzzy functions enables fuzzy_measure_pos, fuzzy_measure_pairs and fuzzy_measure_pairing to evaluate and select the detected candidates of edges and edge pairs. For this purpose, weighting characteristics for different edge features can be defined by one function each. Such a specified feature is called fuzzy set. Specifying no function for a fuzzy set means not to use this feature for the final edge evaluation. Setting a second fuzzy function to a fuzzy set means to discard the first defined function and replace it by the second one. In difference to set_fuzzy_measure, the abscissa x of these functions must be defined relative to the desired size s of the edge pairs (passed in PairSize). This enables a generalized usage of the defined functions. A previously defined normalized fuzzy function can be discarded completely by reset_fuzzy_measure.
For an explanation of the concept of 1D measuring see the introduction of chapter 1D Measuring.
Functions for three different fuzzy set types selected by the SetType parameter can be defined, the sub types of a set being mutual exclusive:
‘size’ denotes a fuzzy set that valuates the normalized distance of two edges of a pair in pixels:
.
Specifying an upper bound x_max for the size by terminating the function with a corresponding fuzzy value of 0.0 will speed up fuzzy_measure_pairs / fuzzy_measure_pairing because not all possible pairs must be considered. Additionally, this fuzzy set can also be specified as a normalized size difference by ‘size_diff’
and a absolute normalized size difference by ‘size_abs_diff’
.
The fuzzy function of ‘position’ evaluates the signed distance p of each edge candidate to the reference point of the measure object, generated by gen_measure_arc or gen_measure_rectangle2:
.
The reference point is located at the beginning whereas ‘position_center’ or ‘position_end’ sets the reference point to the middle or the end of the one-dimensional gray value profile, instead. If the fuzzy position valuation depends on the position of the object along the profile ‘position_first_edge’ / ‘position_last_edge’ sets the referece point at the position of the first/last extracted edge. When extracting edge pairs, the position of a pair is referenced by the geometric average of the fuzzy position scores of both edges.
Similar to ‘position’, ‘position_pair’ evaluates the signed distance of each edge pair to the reference point of the measure object. The position of a pair is defined by the center point between both edges. The object’s reference can be set by ‘position_pair_center’, ‘position_pair_end’ and ‘position_first_pair’, ‘position_last_pair’, respectively. Contrary to ‘position’, this set is only used by fuzzy_measure_pairs/fuzzy_measure_pairing.
A normalized fuzzy function is defined as a piecewise linear function by at least two pairs of values, sorted in an ascending order by their x value. The y values of the fuzzy function represent the weight of the corresponding feature value and must satisfy the range of 0.0 <= y <= 1.0. Outside of the function’s interval, defined by the smallest and the greatest x value, the y values of the interval borders are continued constantly. Such Fuzzy functions can be generated by create_funct_1d_pairs.
If more than one set is defined, fuzzy_measure_pos / fuzzy_measure_pairs / fuzzy_measure_pairing yield the overall fuzzy weighting by the geometric mean of the weights of each set.
执行信息
● 多线程类型:可重入(与非独占算子并行运行)。
● 多线程范围:全局(可以从任何线程调用)。
● 不并行处理。
该算子修改以下输入参数的状态:
MeasureHandle
如果没有全局同步,此参数的值可能不会在多个线程之间共享。
04. 注意
05. 参数
MeasureHandle (input_control, state is modified) measure_id → (integer)
Measure对象句柄。
PairSize (input_control) number → (real / integer)
边缘对的预期宽度。
Default value: 10.0
List of values: 4.0, 6.0, 8.0, 10.0, 15.0, 20.0, 30.0
Typical range of values: 0.0 ≤ PairSize
Minimum increment: 0.1
Recommended increment: 1.0
SetType (input_control) string → (string)
模糊集合的选择。
Default value: ‘size_abs_diff’
List of values: ‘position’, ‘position_center’, ‘position_end’, ‘position_first_edge’, ‘position_first_pair’, ‘position_last_edge’, ‘position_last_pair’, ‘position_pair_center’, ‘position_pair_end’, ‘size’, ‘size_abs_diff’, ‘size_diff’
Function (input_control) function_1d → (real / integer)
模糊函数。
06. 结果
HDevelop例程
fuzzy_measure_pin.hdev 使用模糊测量来测量IC的引脚。
程序示例
* how to use a fuzzy function
* ...
gen_measure_rectangle2 (50, 100, 0, 200, 100, 512, 512, 'nearest_neighbor', \\
MeasureHandle)
* create a generalized fuzzy function to evaluate edge pairs
* * (30% uncertainty).
create_funct_1d_pairs ([0.7,1.0,1.3], [0.0,1.0,0.0], SizeFunction)
* and set it for an expected pair size of 13.45 pixels
set_fuzzy_measure_norm_pair (MeasureHandle, 13.45, 'size', SizeFunction)
fuzzy_measure_pairs (Image, MeasureHandle, 1, 30, 0.5, 'all', RowEdgeFirst, \\
ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, \\
ColumnEdgeSecond, AmplitudeSecond, RowEdgeCenter, \\
ColumnEdgeCenter, FuzzyScore, IntraDistance, \\
InterDistance)
07. 附录
7.1 机器视觉博客汇总
网址:https://dengjin.blog.csdn.net/article/details/116837497
以上是关于机器视觉 set_fuzzy_measure_norm_pair算子的主要内容,如果未能解决你的问题,请参考以下文章