【机器视觉】 fuzzy_measure_pos算子
00. 目錄
文章目錄
- 00. 目錄
- 01. 概述
- 02. 簽名
- 03. 描述
- 04. 注意
- 05. 參數
- 06. 結果
- 07. 附錄
01. 概述
fuzzy_measure_pos - 提取垂直于矩形或環形弧的直邊。
02. 簽名
fuzzy_measure_pos(Image : : MeasureHandle, Sigma, AmpThresh, FuzzyThresh, Transition : RowEdge, ColumnEdge, Amplitude, FuzzyScore, Distance)
03. 描述
fuzzy_measure_pos提取垂直于矩形長軸或環形弧的直邊。 與measure_pos有所區別,它還使用模糊函數(fuzzy functions)來判斷和選擇邊緣。
該算法通過平均垂直于矩形或環形弧的長軸的“切片”中的灰度值來工作,以獲得一維邊緣輪廓。(The algorithm works by averaging the gray values in “slices” perpendicular to the major axis of the rectangle or annular arc in order to obtain a one-dimensional edge profile.)采樣是在矩形中心的整數行和列距離(在矩形的坐標系中)圖像Image中的亞像素位置完成的。由于這涉及一些可以在多次測量中重復使用的計算,所以僅使用算子gen_measure_rectangle2執行一次這些計算,從而顯著提高了fuzzy_measure_pos的速度。由于在灰度值的亞像素計算中存在精度和速度之間的折衷,并且因此在所提取的邊緣位置的準確度中,可以在gen_measure_rectangle2中選擇不同的插值方案。 (插值僅影響矩形軸和圓弧不與圖像對齊的measure。)使用gen_measure_rectangle2生成的measure對象在MeasureHandle中傳遞。
在計算出一維邊緣輪廓之后,通過將輪廓與標準偏差Sigma的高斯平滑核的導數進行卷積來計算亞像素邊緣位置。 可以用構成振幅閾值的參數AmpThresh,即邊緣的一階導數的絕對值來選擇顯著邊緣。 另外,可以僅選擇positive邊緣,即構成矩形長軸方向上的暗到亮的過渡的邊緣(Transition = ‘positive’),或者negative邊緣即亮到暗 (Transition = ‘negative’)或兩種類型的邊緣(Transition = ‘all’)。 最后,可以選擇返回哪個邊緣點。
在提取了亞像素邊緣位置之后,通過相應的模糊函數來評估這些邊緣的特征,這可以通過set_fuzzy_measure來設置。 可以用參數FuzzyThresh確定選擇哪些邊緣,該參數構成了所有模糊集合上權重的閾值,即定義集合的權重的幾何平均值。
選定的邊將作為位于矩形或圓弧長軸上的點返回,這些點存儲在(RowEdge,ColumnEdge)中。 Amplitude中返回相應的邊緣振幅,模糊分數在FuzzyScore中。 另外,連續的邊緣點之間的距離以Distance返回。 這里,Distance[i]對應于Edge[i]和Edge[i + 1]之間的距離,即元組Distance包含(ColumnEdge或RowEdge -1)個元素。
原文描述:
fuzzy_measure_pos extracts straight edges which lie perpendicular to the major axis of a rectangle or an annular arc. In addition to measure_pos it uses fuzzy functions to evaluate and select the edges.
For an explanation of the concept of 1D measuring see the introduction of chapter 1D Measuring.
The algorithm of fuzzy_measure_pos works by averaging the gray values in “slices” perpendicular to the major axis of the rectangle or annular arc in order to obtain a one-dimensional edge profile. The sampling is done at subpixel positions in the image Image at integer row and column distances (in the coordinate frame of the rectangle) from the center of the rectangle. Since this involves some calculations which can be used repeatedly in several measurements, the operator gen_measure_rectangle2 is used to perform these calculations only once, thus increasing the speed of fuzzy_measure_pos significantly. Since there is a trade-off between accuracy and speed in the subpixel calculations of the gray values, and thus in the accuracy of the extracted edge positions, different interpolation schemes can be selected in gen_measure_rectangle2. (The interpolation only influences rectangles not aligned with the image axes and annular arcs.) The measure object generated with gen_measure_rectangle2 is passed in MeasureHandle.
After the one-dimensional edge profile has been calculated, subpixel edge locations are computed by convolving the profile with the derivatives of a Gaussian smoothing kernel of standard deviation Sigma. Salient edges can be selected with the parameter AmpThresh, which constitutes a threshold on the amplitude, i.e., the absolute value of the first derivative of the edge. Additionally, it is possible to select only positive edges, i.e., edges which constitute a dark-to-light transition in the direction of the major axis of the rectangle (Transition = ‘positive’), only negative edges, i.e., light-to-dark transitions (Transition = ‘negative’), or both types of edges (Transition = ‘all’). Finally, it is possible to select which edge points are returned.
Having extracted subpixel edge locations, features of these edges are evaluated by a corresponding fuzzy function, which can be set by set_fuzzy_measure. Which edges are selected can be determined with the parameter FuzzyThresh, which constitutes a threshold on the weight over all fuzzy sets, i.e., the geometric mean of the weights of the defined sets.
The selected edges are returned as single points, which lie on the major axis of the rectangle or annular arc, in (RowEdge,ColumnEdge). The corresponding edge amplitudes are returned in Amplitude, the fuzzy scores in FuzzyScore. In addition, the distance between consecutive edge points is returned in Distance. Here, Distance[i] corresponds to the distance between Edge[i] and Edge[i+1], i.e., the tuple Distance contains one element less than the tuples RowEdge and ColumnEdge.
執行信息
● 多線程類型:可重入(與非獨占算子并行運行)。
● 多線程范圍:全局(可以從任何線程調用)。
● 不并行處理。
04. 注意
只有邊緣是直的并垂直于矩形的長軸,fuzzy_measure_pos返回的結果才有意義。 因此,例如它不應該用于從曲面對象中提取邊緣。 此外,用戶應確保矩形盡可能接近垂直于圖像的邊緣。 此外,Sigma 不能大于約。 0.5 *Length1(對于Length1請參見gen_measure_rectangle2)。
應該記住,為了效率的原因,fuzzy_measure_pos忽略了Image的ROI(domain)。 如果要從測量中排除圖像中的特定區域,則應該生成具有適當修改的參數的新measure對象。
05. 參數
Image (input_object) 單通道圖像→ object (byte / uint2 / real)
輸入圖像。
MeasureHandle (input_control) measure_id → (integer)
measure對象句柄。
Sigma (input_control) number → (real)
高斯模糊Sigma。
Default value: 1.0
Suggested values: 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 7.0, 10.0
Typical range of values: 0.4 ≤ Sigma ≤ 100 (lin)
Minimum increment: 0.01
Recommended increment: 0.1
限制: Sigma >= 0.4
AmpThresh (input_control) number → (real)
最小邊緣幅度。
Default value: 30.0
Suggested values: 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 90.0, 110.0
Typical range of values: 1 ≤ AmpThresh ≤ 255 (lin)
Minimum increment: 0.5
Recommended increment: 2
FuzzyThresh (input_control) number → (real)
最小模糊值
Default value: 0.5
Suggested values: 0.1, 0.3, 0.5, 0.6, 0.7, 0.9
Typical range of values: 0.0 ≤ FuzzyThresh ≤ 1.0 (lin)
Recommended increment: 0.1
Transition (input_control) string → (string)
選擇亮到暗或者暗到亮的邊緣。
Default value: ‘all’
List of values: ‘all’, ‘negative’, ‘positive’
RowEdge (output_control) point.y-array → (real)
Edge點的Row坐標。
ColumnEdge (output_control) point.x-array → (real)
Edge點的Column坐標。
Amplitude (output_control) real-array → (real)
邊緣的邊緣幅度(帶符號)。
FuzzyScore (output_control) real-array → (real)
邊緣模糊評估的分數。
Distance (output_control) real-array → (real)
連續邊之間的距離。
06. 結果
如果參數值正確,則算子fuzzy_measure_pos返回值2(H_MSG_TRUE)。 否則會引發異常。
HDevelop例程
程序示例
07. 附錄
7.1 機器視覺博客匯總
網址:https://dengjin.blog.csdn.net/article/details/116837497
總結
以上是生活随笔為你收集整理的【机器视觉】 fuzzy_measure_pos算子的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【机器视觉】 fuzzy_measure
- 下一篇: 【机器视觉】 gen_measure_a