日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【机器视觉】 measure_pos算子

發布時間:2024/4/24 编程问答 52 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【机器视觉】 measure_pos算子 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

00. 目錄

文章目錄

    • 00. 目錄
    • 01. 概述
    • 02. 簽名
    • 03. 描述
    • 04. 注意
    • 05. 參數
    • 06. 結果
    • 07. 附錄

01. 概述

measure_pos - 提取垂直于矩形或環形弧的直線邊緣。

02. 簽名

measure_pos(Image : : MeasureHandle, Sigma, Threshold, Transition, Select : RowEdge, ColumnEdge, Amplitude, Distance)

03. 描述

measure_pos提取垂直于矩形或環形弧長軸的直邊。

該算法通過計算垂直于矩形或環形弧的長軸的“切片”中的灰度值的均值以獲得一維邊緣輪廓。采樣是在矩形中心的整數行和列位置(在矩形的坐標系中)的圖像Image中的亞像素位置完成的。由于這含有可以在多次測量中重復使用的一些計算,所以使用算子gen_measure_rectangle2或gen_measure_arc來執行一次這些計算,從而顯著提高了measure_pos的速度。由于在灰度值的亞像素計算中存在精度和速度之間的折衷,并且因此在所提取的邊緣位置的準確度中,可以在gen_measure_rectangle2中選擇不同的插值方案。 (插值僅影響與圖像軸不對齊的矩形。)使用gen_measure_rectangle2生成的measure對象在MeasureHandle中傳遞。

在計算出一維邊緣輪廓之后,通過將輪廓與標準偏差Sigma的高斯平滑核的導數進行卷積來計算亞像素邊緣位置。可以用構成振幅閾值的參數Threshold(即邊緣的一階導數的絕對值)來選擇顯著邊緣。請注意,幅度值按Sigmasqrt(2pi)比例縮放。另外,可以僅選擇正邊緣,即在矩形或弧的長軸方向上構成暗到亮的過渡的邊緣(Transition = ‘positive’),或者只有負邊緣,即,亮到暗過渡(Transition =‘negative’)或兩種類型的邊緣(Transition =‘all’)。最后,可以選擇返回哪個邊緣點。如果Select設置為’all’,則返回所有邊緣點。如果設置為’first’,則只返回第一個提取的邊緣點,而設置為’last’,則只返回最后一個。

提取的邊緣將把位于矩形或圓弧長軸上的單個點(RowEdge,ColumnEdge)作為提取的邊緣返回。 Amplitude返回相應的邊緣振幅。 另外,連續的邊緣點之間的距離以Distance返回。 這里, Distance[i]對應于Edge[i]和Edge[i+1]之間的距離,即,元組Distance 含有比(RowEdge 和ColumnEdge)的長度-1個元素

原文描述

measure_pos extracts straight edges which lie perpendicular to the major axis of a rectangle or annular arc.

For an explanation of the concept of 1D measuring see the introduction of chapter 1D Measuring.

The algorithm of 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 or gen_measure_arc is used to perform these calculations only once, thus increasing the speed of 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.) 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 Threshold, which constitutes a threshold on the amplitude, i.e., the absolute value of the first derivative of the edge. Note that the amplitude values are scaled by the factor . 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 or the arc (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. If Select is set to ‘all’, all edge points are returned. If it is set to ‘first’, only the first of the extracted edge points is returned, while it is set to ‘last’, only the last one is returned.

The extracted edges are returned as single points which lie on the major axis of the rectangle or arc in (RowEdge,ColumnEdge). The corresponding edge amplitudes are returned in Amplitude. 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. 注意

只有邊緣是直的并垂直于矩形或弧的長軸,measure_pos返回的結果才有意義。 因此它不應該用于從曲面對象中提取邊緣。 此外用戶應確保矩形或弧線盡可能接近垂直于圖像中的邊緣。 此外,西格瑪不能大于約0.5 * Length1(對于Lenth1請參見gen_measure_rectangle2)。

應該記住,為了效率的原因,measure_pos會忽略Image的ROI域。 如果圖像中的特定區域應該從measurement中排除,則應該生成具有適當修改的參數的新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
  Restriction: Sigma >= 0.4

Threshold (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 ≤ Threshold ≤ 255 (lin)
  Minimum increment: 0.5
  Recommended increment: 2

Transition (input_control) string → (string)
  亮到暗或者暗到亮的邊緣。
  Default value: ‘all’
  List of values: ‘all’, ‘negative’, ‘positive’

Select (input_control) string → (string)
  要選擇返回的點。
  Default value: ‘all’
  List of values: ‘all’, ‘first’, ‘last’

RowEdge (output_control) point.y-array → (real)
  邊緣中心的Row坐標。

ColumnEdge (output_control) point.x-array → (real)
  邊緣中心的Column坐標。

Amplitude (output_control) real-array → (real)
  邊緣的邊緣幅度(帶符號)。

Distance (output_control) real-array → (real)
  連續邊之間的距離。

06. 結果

如果參數值正確,則算子measure_pos返回值2(H_MSG_TRUE)。 否則會引發異常。

HDevelop例程

measure_pin.hdev         測量IC的引腳

measure_ic_leads.hdev     測量IC的引線

measure_fill_level.hdev       檢查細頸瓶的液位

measure_arc.hdev         測量金屬部件沿著圓弧的的寬度

gen_measure_rectangle2.hdev   測量垂直于給定線的邊緣
gen_measure_arc.hdev       測量垂直于給定弧的邊

create_drawing_object_rectangle2.hdev 使用繪圖對象在矩形內交互測量直邊
3d_coordinates.hdev         測量世界坐標中的傾斜物體

程序示例

07. 附錄

7.1 機器視覺博客匯總
網址:https://dengjin.blog.csdn.net/article/details/116837497

總結

以上是生活随笔為你收集整理的【机器视觉】 measure_pos算子的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。