机器视觉 set_fuzzy_measure算子

Posted 沧海一笑-dj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了机器视觉 set_fuzzy_measure算子相关的知识,希望对你有一定的参考价值。

00. 目录

01. 概述

set_fuzzy_measure - 指定一个模糊函数。

02. 签名

set_fuzzy_measure( : : MeasureHandle, SetType, Function : )

03. 描述

set_fuzzy_measure指定在函数中传递的模糊函数。 指定的模糊函数使得fuzzy_measure_pos和fuzzy_measure_pairs / fuzzy_measure_pairing能够评估和选择检测到的候选边缘。 为此,不同边缘特征的加权特征可以由一个函数来定义。 这种特定的特征被称为模糊集合。 模糊集没有指定的功能意味着不使用此功能进行最终边缘评估。 将第二个模糊函数设置意味着放弃第一个定义的函数并将其替换为第二个函数。 以前定义的模糊函数可以通过reset_fuzzy_measure完全丢弃。

可以定义由SetType参数选择的五种不同模糊集合类型的函数,一个集合的子类型是互斥的:

'contrast’将使用模糊函数来评估候选边缘的幅度。 在提取边缘对时,通过两边的模糊对比度评分的几何平均来获得模糊评估。

'position’的模糊函数评估由gen_measure_arc或gen_measure_rectangle2生成的每个候选边缘到度量对象的参考点的距离。 参考点位于开始位置,而“position_center”或“position_end”将参考点设置为一维灰度值轮廓的中间或末端。 如果模糊位置评估取决于物体沿着轮廓的位置,‘position_first_edge’/‘position_last_edge’将参考点设置在第一个/最后提取的边缘的位置处。 当提取边缘对时,边缘对的位置被两边的模糊位置分数的几何平均值所引用。

与’position’相似,‘position_pair’计算每个边对与measure对象的参考点之间的距离。 一个边缘对的位置由两个边缘之间的中心点定义。 对象的参考点可以分别由’position_pair_center’,‘position_pair_end’和’position_first_pair’,'position_last_pair’来设置。 与’position’不同的是,该设置仅由fuzzy_measure_pairs / fuzzy_measure_pairing使用。

'size’表示一个模糊设置,该设置为以像素为单位评估一对的两条边的规定距离。 该集合仅由fuzzy_measure_pairs / fuzzy_measure_pairing使用。 通过以相应的模糊值0.0终止函数来指定大小的上限将加快fuzzy_measure_pairs / fuzzy_measure_pairing,因为不需要考虑所有可能的对。

'gray’设置模糊函数来对一对的两个边缘之间的平均投影灰度值进行加权。 该集合仅由fuzzy_measure_pairs / fuzzy_measure_pairing使用。

一个模糊函数被定义为一个分段线性函数,由至少两对值按升序按x值排序。 x值表示边缘特征,并且必须位于设置类型的参数空间内,即,在’contrast’和’gray’特征的情况下,例如在0.0≤x≤255.0的范围内的byte图像。 'size’x必须满足0.0 <= x,而 'position’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 specifies a fuzzy function passed in Function. The specified fuzzy functions enable fuzzy_measure_pos and fuzzy_measure_pairs / fuzzy_measure_pairing to evaluate and select the detected edge candidates. 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 set means to discard the first defined function and replace it by the second one. A previously defined 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 five different fuzzy set types selected by the SetType parameter can be defined, the sub types of a set being mutual exclusive:

‘contrast’ will use the fuzzy function to evaluate the amplitudes of the edge candidates. When extracting edge pairs, the fuzzy evaluation is obtained by the geometric average of the fuzzy contrast scores of both edges.

The fuzzy function of ‘position’ evaluates the distance 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 evaluation 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 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.

‘size’ denotes a fuzzy set that evaluates the normed distance of the two edges of a pair in pixels. This set is only used by fuzzy_measure_pairs/fuzzy_measure_pairing. Specifying an upper bound 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 need to be considered.

‘gray’ sets a fuzzy function to weight the mean projected gray value between two edges of a pair. This set is only used by fuzzy_measure_pairs / fuzzy_measure_pairing.

A 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 x values represent the edge feature and must lie within the parameter space of the set type, i.e., in case of ‘contrast’ and ‘gray’ feature and, e.g., byte images within the range 0.0 <= x <= 255.0. In case of ‘size’ x has to satisfy 0.0 <= x whereas in case of ‘position’ x can be any real number. The y values of the fuzzy function represent the weight of the corresponding feature value and have to 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 middle of the weights of each set.

执行信息

●  多线程类型:可重入(与非独占算子并行运行)。
●  多线程范围:全局(可以从任何线程调用)。
●  不并行处理。

该算子修改以下输入参数的状态:

MeasureHandle

如果没有全局同步,此参数的值可能不会在多个线程之间共享。

04. 注意

05. 参数

SetType (input_control)   string → (string)
  模糊集合的选择。: ‘contrast’
  List of values: ‘contrast’, ‘gray’, ‘position’, ‘position_center’, ‘position_end’, ‘position_first_edge’, ‘position_first_pair’, ‘position_last_edge’, ‘position_last_pair’,   ‘position_pair_center’, ‘position_pair_end’, ‘size’

Function (input_control)    function_1d → (real / integer)
  模糊函数。

06. 结果

HDevelop例程

inspect_bottle_label_360_degree.hdev 将一个瓶子的四个图像组合成拼接图像,显示瓶子的展开标签
fuzzy_measure_switch.hdev     用一个模糊度量对象确定一个开关引脚的宽度和距离

程序示例

* 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 transform it to expected size of 13.45 pixels
transform_funct_1d (SizeFunction, [1.0,0.0,13.45,0.0], TransformedFunction)
set_fuzzy_measure (MeasureHandle, 'size', TransformedFunction)

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算子的主要内容,如果未能解决你的问题,请参考以下文章

论文GRNN:几何视觉的神经网络算法库

如何选择机器视觉软件

EasyCV开源|开箱即用的视觉自监督+Transformer算法库

飞行机器人专栏-- 异构多视角视觉系统

计算机视觉,凉了?

学习了哪些知识,计算机视觉才算入门