Halcon calibration procedure

Halcon calibration procedure

1. Set initial values ​​of the internal parameters of the camera

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 camera models

      (1) an area array

      (2) linear array

  1.2 parameter (where they talk area camera)

      (1) Division distortion model

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

      (2) Polynomial distortion model

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

          NOTE: When the lens is a telecentric lens, Focus = 0;

  1.3 distortion type selection

      Division distortion model applies only to progress is not very high, calibration with less number of pictures; Polynomial distortion model image

      And distortion correction are tangential to the distortion, high accuracy, it takes a long time.

  Skills determine a parameter value of 1.4 Calibration

      Focus f: focal length of the lens a nominal, eg, 0.016 m .; as for the telecentric lens of 0. The
      [kappa]: general to 0.0
      Or:
      Kl, K2, K3, Pl, P2: all can be initialized to 0
      to Sx: is determined by the recommended CCDCMOS values are as follows:
           Full Image (640 * 480) subsampling (320. 240 *)
           1/3 "-chip 0.0000055 0.0000110 m m
           1/2" -chip .0000086 .0000172 m m
           2/3 "-chip 0.0000110 0.0000220 m m
      Sy: the CCDCMOS determine the recommended values are as follows:

          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: initial coordinate values of the optical center, this parameter is as follows:
         for Example:
          Full Image (640 * 480) subsampling (320. * 240)
          Cx 320.0 160.0
          Cy 240.0 120.0
      ImageWidth will not, the ImageHeight: actual image size to initialize the value
       for Example:
      Full Image (640 * 480) subsampling (320. * 240)
      ImageWidth will not 640 320.
      the ImageHeight 480 240

2. Calibration board initialization

    CaltabName: = 'caltab_30mm.descr' // calibration plate description file
    set_calib_data_calib_object (CalibDataID, 0, CaltabName)

3. Create a data model

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

4. Get Picture Calibration

    Camera images under different pose sheets 8-15, the calibration plate try to cover the whole field of view (to the calibration plate working distance, field size tailored) to take a picture; diameter on the captured image can not be less than 10 pixels

5. Load all images, to find the calibration plate area, the center is determined, the result is loaded into the component

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

General principle will be to extract the target point Halcon said this:

First find_caltab operator Gaussian filtering on the image (core size SizeGauss), followed by thresholding (with a size of MarkThresh) to find out the calibration area of ​​the panel, find_marks_and_pose operator region of the divided circle, the circle to find the number, perimeter, a coordinate position and the like should be consistent with the calibration plate description file, otherwise it will automatically adjust StartThresh, such StartThresh reduced according to step DeltaThresh MinThresh, know where to find the exact center.

6. With all the center of the image can be calibrated

    calibrate_cameras (CalibDataID, Errors)

    Errors mean projection error return

以下是一个伪代码段.......(明天再续)
* Calibration parameters
CaltabDescr := 'caltab_100mm.descr'
CaltabThickness := 0.0064
NumCameras := 4
NumCalibObjects := 1
NumPoses := 20
CameraType := '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 parameters
create_calib_data ('calibration_object', NumCameras, NumCalibObjects, CalibDataID)
* Set used camara type
set_calib_data_cam_param (CalibDataID, 'all', CameraType, StartCamPar)
* Set used calibration object
set_calib_data_calib_object (CalibDataID, 0, CaltabDescr)

Guess you like

Origin www.cnblogs.com/wwwbdabc/p/11652422.html