Halcon標定步驟

Halcon標定步驟app

1.設置相機內部參數的初始值ui

StartCamPar := [0.016,0,0.0000074,0.0000074,326,247,652,494]
set_calib_data_cam_param (CalibDataID, 0, 'area_scan_division', StartCamPar)圖片

  1.1 相機型號ip

      (1)面陣io

      (2)線陣原理

  1.2 參數設置(這裏只講面陣相機)sed

      (1)Division畸變模型object

          CameraParam:[Focus, Kappa, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight]model

      (2)Polynomial 畸變模型技巧

          CameraParam:[Focus, K1, K2, K3, P1, P2, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight]

          注:當鏡頭爲遠心鏡頭時,Focus=0;

  1.3 畸變類型的選擇

      Division畸變模型只適用於進度要求不是很高,標定圖片數量較少的狀況;Polynomial 畸變模型對鏡像

      畸變和切向畸變都校訂,精度較高,花費時間長。

  1.4 標定時個參數值的肯定技巧

      Focus f:鏡頭的標稱焦距, e.g., 0.016 m.; 對於遠心鏡頭爲0.
      κ: 通常去0.0
      Or:
      K1, K2, K3,P1, P2:可所有初始化爲0
      Sx: 由CCDCMOS肯定建議取值以下:
           Full image (640*480) Subsampling (320*240)
           1/3"-Chip 0.0000055 m 0.0000110 m
           1/2"-Chip 0.0000086 m 0.0000172 m
           2/3"-Chip 0.0000110 m 0.0000220 m
      Sy: 由CCDCMOS肯定建議取值以下:

          for example:
           Full image (640*480) Subsampling (320*240)
           1/3"-Chip 0.0000055 m 0.0000110 m
           1/2"-Chip 0.0000086 m 0.0000172 m
           2/3"-Chip 0.0000110 m 0.0000220 m

      Cx and Cy: 光心座標初始值,建議取值以下:
         for example:
          Full image (640*480) Subsampling (320*240)
          Cx 320.0 160.0
          Cy 240.0 120.0
      ImageWidth,ImageHeight:有實際圖片大小來初始化該值
       for example:
      Full image (640*480) Subsampling (320*240)
      ImageWidth 640 320
      ImageHeight 480 240

2.標定板初始化

    CaltabName := 'caltab_30mm.descr'//標定板描述文件
    set_calib_data_calib_object (CalibDataID, 0, CaltabName)

3.建立數據模型

create_calib_data ('calibration_object', 1, 1, CalibDataID)

4.獲取標定圖片

    相機拍攝不一樣位姿下圖片8-15張,拍攝圖片時標定板儘可能覆蓋整個視場(標定板要根據工做距離、視場大小定製);拍攝圖片上的圓直徑不得小於10個像素

5.加載全部圖像,尋找標定板區域,肯定圓心,將結果加載到組元中

for I := 1 to NumImages by 1
... acquire image ...
  find_caltab (Image, Caltab, CaltabName, SizeGauss, MarkThresh, MinDiamMarks)
  find_marks_and_pose (Image, Caltab, CaltabName, StartCamPar, StartThresh, 
      DeltaThresh, MinThresh, Alpha, MinContLength, MaxDiamMarks, RCoord, CCoord, StartPose)
  set_calib_data_observ_points (CalibDataID, 0, 0, I, RCoord, CCoord, 'all', StartPose)
endfor

下面將Halcon中提取目標點的大體原理說一下:

首先find_caltab 算子對圖像高斯濾波(核大小爲SizeGauss),接着閾值分割(與之大小爲MarkThresh)將標定板的區域找出來, find_marks_and_pose 算子對區域中的圓進行分割,找到圓的個數,周長,座標位置等應該和標定板描述文件中的一致,不然會自動調整StartThresh,使得StartThresh按照DeltaThresh步長減少到MinThresh,知道找到準確的圓心。

6.有了全部圖像中的圓心就能夠標定了

    calibrate_cameras (CalibDataID, Errors)

    返回平均投影偏差Errors

如下是一個僞代碼段.......(明天再續)* Calibration parametersCaltabDescr := 'caltab_100mm.descr'CaltabThickness := 0.0064NumCameras := 4NumCalibObjects := 1NumPoses := 20CameraType := 'area_scan_polynomial'StartCamPar := [0.0085, 0.0, 0.0, 0.0, 0.0, 0.0, 6e-6, 6e-6, Width*.5, Height*.5, Width, Height]** Create camera calibration model and set parameterscreate_calib_data ('calibration_object', NumCameras, NumCalibObjects, CalibDataID)* Set used camara typeset_calib_data_cam_param (CalibDataID, 'all', CameraType, StartCamPar)* Set used calibration objectset_calib_data_calib_object (CalibDataID, 0, CaltabDescr)

相關文章
相關標籤/搜索