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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > ChatGpt >内容正文

ChatGpt

Halcon - 定位 - 卡尺

發布時間:2024/7/5 ChatGpt 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Halcon - 定位 - 卡尺 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

以直線卡尺為例,其他卡尺更改相應參數即可。

Code

直線卡尺

* 獲取圖像及圖像尺寸 dev_close_window () read_image (Image, 'fabrik') get_image_size (Image, Width, Height) dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle) dev_set_line_width (1) dev_display (Image)* 標記測量位置 draw_line (WindowHandle, Row1, Column1, Row2, Column2) LineParams := [Row1, Column1, Row2, Column2]* 創建測量句柄 create_metrology_model (MetrologyHandle) * 添加測量對象 set_metrology_model_image_size (MetrologyHandle, Width, Height) add_metrology_object_generic (MetrologyHandle, 'line', LineParams, 20, 3, 1, 30, [], [], Index)* 設置測量對象的參數 * set_metrology_object_param (MetrologyHandle, 'all', 'measure_transition', 'negative') * set_metrology_object_param (MetrologyHandle, 'all', 'num_measures',10) * set_metrology_object_param (MetrologyHandle, 'all', 'num_instances', 1) * set_metrology_object_param (MetrologyHandle, 'all', 'measure_sigma', 1) * set_metrology_object_param (MetrologyHandle, 'all', 'measure_length1', 20) * set_metrology_object_param (MetrologyHandle, 'all', 'measure_length2', 5) * set_metrology_object_param (MetrologyHandle, 'all', 'measure_threshold',30) * set_metrology_object_param (MetrologyHandle, 'all', 'measure_interpolation', 'bicubic') * set_metrology_object_param (MetrologyHandle, 'all', 'measure_select', 'all') * set_metrology_object_param (MetrologyHandle, 'all', 'min_score', 0.7)* 執行測量,獲取邊緣點集 dev_set_color ('yellow') apply_metrology_model (Image, MetrologyHandle) get_metrology_object_measures (Contours, MetrologyHandle, 'all', 'all', Row, Column) dev_set_color ('red') gen_cross_contour_xld (Cross, Row, Column, 6, 0.785398)* 獲取最終測量數據和輪廓線 dev_set_color ('green') dev_set_line_width (2) get_metrology_object_result (MetrologyHandle, 'all', 'all', 'result_type', 'all_param', Parameter) get_metrology_object_result_contour (Contour, MetrologyHandle, 'all', 'all', 1.5)* 釋放測量句柄 clear_metrology_model (MetrologyHandle)

Result

Explanation

set_metrology_model_image_size( : : MetrologyHandle, Width, Height : )

使用 set_metrology_model_image_size 該算子設置測量區域,而且該算子必須在 add_metrology_object_generic 這類添加測量對象的算子之前調用,否則在使用 apply_metrology_model 執行測量時會重新計算測量區域,降低效率。

add_metrology_object_generic( : : MetrologyHandle, Shape, ShapeParam, MeasureLength1, MeasureLength2, MeasureSigma, MeasureThreshold, GenParamName, GenParamValue : Index)

參數 Shape 和 ShapeParam 是聯動的:

  • Shape = circle 時,ShapeParam=[Row, Column, Radius]
  • Shape = rectangle2 時,ShapeParam=[Row, Column, Phi, Length1, Length2]
  • Shape = ellipse 時,ShapeParam=[Row, Column, Phi, Radius1, Radius2]
  • Shape = line 時,ShapeParam=[RowBegin, ColumnBegin, RowEnd, ColumnEnd]

set_metrology_object_param( : : MetrologyHandle, Index, GenParamName, GenParamValue : )

創建測量區域的相關參數

  • measure_length1:The value of this parameter specifies the half length of the measure regions perpendicular to the metrology object boundary.
  • measure_length2:The value of this parameter specifies the half length of the measure regions tangential to the metrology object boundary.
  • measure_distance:The value of this parameter specifies the desired distance between the centers of two measure regions.
  • num_measures:The value of this parameter specifies the desired number of measure regions.

提取邊緣的相關參數

  • measure_sigma:The parameter specifies the sigma for the Gaussian smoothing.
  • measure_threshold:The parameter specifies the minimum edge amplitude.
  • measure_select:The parameter specifies the selection of end points of the edges.
  • measure_transition:The parameter specifies the use of dark/light or light/dark edges.
  • measure_interpolation:The parameter specifies the type of interpolation to be used.

擬合幾何形狀的相關參數

  • min_score: The parameter determines what score a potential instance must at least have to be regarded as a valid instance of the metrology object.
  • num_instances: The parameter specifies the maximum number of successfully fitted instances of each metrology object after which the fitting will stop.
  • distance_threshold: apply_metrology_model uses a randomized search algorithm (RANSAC) to fit the geometric shapes.
  • max_num_iterations: The RANSAC algorithm estimates the number of iterations necessary for fitting the requested geometric shape.
  • rand_seed: The parameter specifies the seed for the random number generator for the RANSAC algorithm that is used by the selection of the edges the in operator apply_metrology_model.
  • instances_outside_measure_regions: The parameter specifies the validation of the results of measurements.

轉載于:https://www.cnblogs.com/zdfffg/p/11572249.html

總結

以上是生活随笔為你收集整理的Halcon - 定位 - 卡尺的全部內容,希望文章能夠幫你解決所遇到的問題。

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