Halcon self calibration operator radial_ distortion_ self_ Error using calibration. Error code: 3661

1. Problem description

*Correct radial distortion
*halcon A self calibration operator is provided, which can calibrate the internal parameters of the camera (no focal length) without a calibration board. Compared with multiple calibration, the external parameters of the camera cannot be obtained.
*The distortion correction can be carried out after the internal parameters of the camera are obtained. Therefore, compared with multiple calibration, the self calibration is faster in distortion correction, so that the equipment is easier to operate and maintain on site.
*Refer to official routine
*radial_distortion.hdev
*radial_distortion_self_calibration.hdev

*Name: radial distortion self calibration
*Description: this operator passes XLD The distortion parameters and distortion center of the lens are estimated from the contour data. The parameters obtained are obtained through the parameters in the camera CameraParam return.
*This operator cannot correct the focal length and scale factor, so it cannot be used for 3 D Measuring.
*If the camera model is area(division),Then the camera parameters are 7, if area(polynomial),Then there are 12 camera parameters.
radial_distortion_self_calibration(lines, SelectedLines, Width, Height, 0.5, 42, 'division', 'variable', 0, CameraParam)

*Name: correction distortion parameters
*Description: calculate the ideal distortion free camera internal parameters according to the specified radial distortion coefficient.
change_radial_distortion_cam_par('fixed', CameraParam, 0, CamParamOut)

*Name: method for correcting distorted image 1
*Description: corrects the distortion of the input image according to the specified image and the specified addition parameters.
get_domain(Imagecalib, Domain)
change_radial_distortion_image(Imagecalib, Domain, Image_rectified1, CameraParam, CamParamOut)

*Method for correcting distorted image 2,The effect is exactly the same as method 1
gen_radial_distortion_map(Map, CameraParam, CamParamOut, 'bilinear')
map_image(Imagecalib, Map, ImageMapped)

Execute to radial_ distortion_ self_ No stable solution found: please change the inner threshold or select contours manually (Halcon error code: 3661).

What's going on?

 

2. Solution

Set the DistortionCenter parameter of the operator to 'fixed' or 'adaptive'

3. What is self calibration

halcon provides a self calibration operator, which can calibrate the camera internal parameters (no focal length) without a calibration board. Compared with multiple calibration, it can not obtain the camera external parameters. The distortion correction can be carried out after the internal parameters of the camera are obtained. Therefore, compared with multiple calibration, the self calibration is faster in distortion correction, so that the equipment is easier to operate and maintain on site. After distortion correction, we can also place a reference object to calculate the pixel equivalent and construct the XY world coordinate system for measurement, positioning and other applications.

4. Self calibration correlation operator

radial_distortion_self_calibration(Contours : SelectedContours : Width, Height, InlierThreshold, RandSeed, DistortionModel, DistortionCenter, PrincipalPointVar : CameraParam)

Name: radial distortion self calibration

Description: this operator estimates the lens distortion parameters and distortion center through XLD contour data. The obtained parameters are returned through the camera internal parameter CameraParam. This operator cannot correct the focal length and scale factor, so it cannot be used in 3D measurement.

Parameters:

Contours: enter contour data for correction

SelectedContours: corrected contour data

Width: gets the image width of the contour data

Height: obtain the image height of contour data

InlierThreshold: classification threshold

RandSeed: random seed

DistortionModel: distortion mode

DistortionCenter: estimation mode of distortion center

PrincipalPointVar: deviation control

CameraParam: output camera internal parameters

change_radial_distortion_cam_par( : : Mode, CamParamIn, DistortionCoeffs : CamParamOut)

Name: corrected distortion parameters

Description: calculate the ideal distortion free camera internal parameters according to the specified radial distortion coefficient.

Parameters:

Mode: distortion mode

CamParamIn: distorted camera internal parameters

DistortionCoeffs: distortion coefficient value

CamParamOut: corrected camera internal parameters

change_radial_distortion_image(Image, Region : ImageRectified : CamParamIn, CamParamOut : )

Name: corrected distorted image

Description: corrects the distortion of the input image according to the specified image and the specified addition parameters.

Parameters:

Image: input image

Region: the region of the corrected image

Imagecorrected: corrected image

CamParamIn: enter camera parameters

CamParamOut: output camera parameters

Tags: C++ Halcon

Posted on Tue, 16 Nov 2021 05:38:48 -0500 by FireWhizzle