ClassesClassesClassesClasses | | | | Operators

binocular_calibrationT_binocular_calibrationBinocularCalibrationbinocular_calibrationBinocularCalibrationBinocularCalibration (Operator)

Name

binocular_calibrationT_binocular_calibrationBinocularCalibrationbinocular_calibrationBinocularCalibrationBinocularCalibration — Determine all camera parameters of a binocular stereo system.

Signature

binocular_calibration( : : NX, NY, NZ, NRow1, NCol1, NRow2, NCol2, StartCamParam1, StartCamParam2, NStartPose1, NStartPose2, EstimateParams : CamParam1, CamParam2, NFinalPose1, NFinalPose2, RelPose, Errors)

Herror T_binocular_calibration(const Htuple NX, const Htuple NY, const Htuple NZ, const Htuple NRow1, const Htuple NCol1, const Htuple NRow2, const Htuple NCol2, const Htuple StartCamParam1, const Htuple StartCamParam2, const Htuple NStartPose1, const Htuple NStartPose2, const Htuple EstimateParams, Htuple* CamParam1, Htuple* CamParam2, Htuple* NFinalPose1, Htuple* NFinalPose2, Htuple* RelPose, Htuple* Errors)

Herror binocular_calibration(const HTuple& NX, const HTuple& NY, const HTuple& NZ, const HTuple& NRow1, const HTuple& NCol1, const HTuple& NRow2, const HTuple& NCol2, const HTuple& StartCamParam1, const HTuple& StartCamParam2, const HTuple& NStartPose1, const HTuple& NStartPose2, const HTuple& EstimateParams, HTuple* CamParam1, HTuple* CamParam2, HTuple* NFinalPose1, HTuple* NFinalPose2, HTuple* RelPose, HTuple* Errors)

void BinocularCalibration(const HTuple& NX, const HTuple& NY, const HTuple& NZ, const HTuple& NRow1, const HTuple& NCol1, const HTuple& NRow2, const HTuple& NCol2, const HTuple& StartCamParam1, const HTuple& StartCamParam2, const HTuple& NStartPose1, const HTuple& NStartPose2, const HTuple& EstimateParams, HTuple* CamParam1, HTuple* CamParam2, HTuple* NFinalPose1, HTuple* NFinalPose2, HTuple* RelPose, HTuple* Errors)

static HTuple HPose::BinocularCalibration(const HTuple& NX, const HTuple& NY, const HTuple& NZ, const HTuple& NRow1, const HTuple& NCol1, const HTuple& NRow2, const HTuple& NCol2, const HTuple& StartCamParam1, const HTuple& StartCamParam2, const HPoseArray& NStartPose1, const HPoseArray& NStartPose2, const HTuple& EstimateParams, HTuple* CamParam2, HPoseArray* NFinalPose1, HPoseArray* NFinalPose2, HPose* RelPose, HTuple* Errors)

HTuple HPose::BinocularCalibration(const HTuple& NX, const HTuple& NY, const HTuple& NZ, const HTuple& NRow1, const HTuple& NCol1, const HTuple& NRow2, const HTuple& NCol2, const HTuple& StartCamParam1, const HTuple& StartCamParam2, const HPose& NStartPose2, const HString& EstimateParams, HTuple* CamParam2, HPose* NFinalPose1, HPose* NFinalPose2, HPose* RelPose, double* Errors) const

HTuple HPose::BinocularCalibration(const HTuple& NX, const HTuple& NY, const HTuple& NZ, const HTuple& NRow1, const HTuple& NCol1, const HTuple& NRow2, const HTuple& NCol2, const HTuple& StartCamParam1, const HTuple& StartCamParam2, const HPose& NStartPose2, const char* EstimateParams, HTuple* CamParam2, HPose* NFinalPose1, HPose* NFinalPose2, HPose* RelPose, double* Errors) const

void HOperatorSetX.BinocularCalibration(
[in] VARIANT NX, [in] VARIANT NY, [in] VARIANT NZ, [in] VARIANT NRow1, [in] VARIANT NCol1, [in] VARIANT NRow2, [in] VARIANT NCol2, [in] VARIANT StartCamParam1, [in] VARIANT StartCamParam2, [in] VARIANT NStartPose1, [in] VARIANT NStartPose2, [in] VARIANT EstimateParams, [out] VARIANT* CamParam1, [out] VARIANT* CamParam2, [out] VARIANT* NFinalPose1, [out] VARIANT* NFinalPose2, [out] VARIANT* RelPose, [out] VARIANT* Errors)

VARIANT HPoseX.BinocularCalibration(
[in] VARIANT NX, [in] VARIANT NY, [in] VARIANT NZ, [in] VARIANT NRow1, [in] VARIANT NCol1, [in] VARIANT NRow2, [in] VARIANT NCol2, [in] VARIANT StartCamParam1, [in] VARIANT StartCamParam2, [in] VARIANT NStartPose1, [in] VARIANT NStartPose2, [in] VARIANT EstimateParams, [out] VARIANT* CamParam2, [out] VARIANT* NFinalPose1, [out] VARIANT* NFinalPose2, [out] VARIANT* RelPose, [out] VARIANT* Errors)

static void HOperatorSet.BinocularCalibration(HTuple NX, HTuple NY, HTuple NZ, HTuple NRow1, HTuple NCol1, HTuple NRow2, HTuple NCol2, HTuple startCamParam1, HTuple startCamParam2, HTuple NStartPose1, HTuple NStartPose2, HTuple estimateParams, out HTuple camParam1, out HTuple camParam2, out HTuple NFinalPose1, out HTuple NFinalPose2, out HTuple relPose, out HTuple errors)

static HTuple HPose.BinocularCalibration(HTuple NX, HTuple NY, HTuple NZ, HTuple NRow1, HTuple NCol1, HTuple NRow2, HTuple NCol2, HTuple startCamParam1, HTuple startCamParam2, HPose[] NStartPose1, HPose[] NStartPose2, HTuple estimateParams, out HTuple camParam2, out HPose[] NFinalPose1, out HPose[] NFinalPose2, out HPose relPose, out HTuple errors)

HTuple HPose.BinocularCalibration(HTuple NX, HTuple NY, HTuple NZ, HTuple NRow1, HTuple NCol1, HTuple NRow2, HTuple NCol2, HTuple startCamParam1, HTuple startCamParam2, HPose NStartPose2, string estimateParams, out HTuple camParam2, out HPose NFinalPose1, out HPose NFinalPose2, out HPose relPose, out double errors)

Description

In general, binocular calibration means the exact determination of the parameters that model the 3D reconstruction of a 3D point from the corresponding images of this point in a binocular stereo system. This reconstruction is specified by the internal parameters CamParam1CamParam1CamParam1CamParam1CamParam1camParam1 of camera 1 and CamParam2CamParam2CamParam2CamParam2CamParam2camParam2 of camera 2 describing the underlying projective camera model, and the external parameters RelPoseRelPoseRelPoseRelPoseRelPoserelPose describing the relative pose of camera system 2 in relation to camera system 1.

Thus, known 3D model points (with coordinates NXNXNXNXNXNX, NYNYNYNYNYNY, NZNZNZNZNZNZ) are projected in the image planes of both cameras (camera 1 and camera 2) and the sum of the squared distances between these projections and the corresponding measured image points (with coordinates NRow1NRow1NRow1NRow1NRow1NRow1, NCol1NCol1NCol1NCol1NCol1NCol1 for camera 1 and NRow2NRow2NRow2NRow2NRow2NRow2, NCol2NCol2NCol2NCol2NCol2NCol2 for camera 2) is minimized. It should be noted that all these model points must be visible in both images. The used camera model is described in camera_calibrationcamera_calibrationCameraCalibrationcamera_calibrationCameraCalibrationCameraCalibration. The camera model is represented by the parameters [focus, kappa, sx, sy, cx, cy, image_width, image_height] (for each camera separately) if the lens distortions are modelled with the division model. If the lens distortions are modelled with the polynomial model, the camera model is represented by the parameters [focus, k1, k2, k3, p1, p2, sx, sy, cx, cy, image_width, image_height] (for each camera separately). The projection uses the initial values StartCamParam1StartCamParam1StartCamParam1StartCamParam1StartCamParam1startCamParam1 and StartCamParam2StartCamParam2StartCamParam2StartCamParam2StartCamParam2startCamParam2 of the internal parameters of camera 1 and camera 2 which can be obtained from the camera data sheets. In addition, the initial guesses NStartPose1NStartPose1NStartPose1NStartPose1NStartPose1NStartPose1 and NStartPose2NStartPose2NStartPose2NStartPose2NStartPose2NStartPose2 of the poses of the 3D calibration model in relation to the camera coordinate systems (CCS) of camera 1 and camera 2 are needed as well. These 3D transformation poses can be determined by the find_marks_and_posefind_marks_and_poseFindMarksAndPosefind_marks_and_poseFindMarksAndPoseFindMarksAndPose operator. Since this calibration algorithm simultaneously handles correspondences between measured image and known model points from different image pairs, poses (NStartPose1NStartPose1NStartPose1NStartPose1NStartPose1NStartPose1,NStartPose2NStartPose2NStartPose2NStartPose2NStartPose2NStartPose2), and measured points (NRow1NRow1NRow1NRow1NRow1NRow1,NCol1NCol1NCol1NCol1NCol1NCol1,NRow2NRow2NRow2NRow2NRow2NRow2, NCol2NCol2NCol2NCol2NCol2NCol2) must be passed concatenated in a corresponding order.

The input parameter EstimateParamsEstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams is used to select the parameters to be estimated. Usually this parameter is set to 'all'"all""all""all""all""all", i.e., all external camera parameters (translation and rotation) and all internal camera parameters are determined. Otherwise, EstimateParamsEstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams contains a tuple of strings indicating the combination of parameters to estimate. For instance, if the internal camera parameters already have been determined (e.g., by previous calls to camera_calibrationcamera_calibrationCameraCalibrationcamera_calibrationCameraCalibrationCameraCalibration) it is often desired to only determine relative the pose of the two cameras to each other (RelPoseRelPoseRelPoseRelPoseRelPoserelPose). In this case, EstimateParamsEstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams can be set to 'pose_rel'"pose_rel""pose_rel""pose_rel""pose_rel""pose_rel". This has the same effect as EstimateParamsEstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams = ['pose1','pose2']["pose1","pose2"]["pose1","pose2"]["pose1","pose2"]["pose1","pose2"]["pose1","pose2"]. The internal parameters can be subsumed by the parameter values 'cam_param1'"cam_param1""cam_param1""cam_param1""cam_param1""cam_param1" and 'cam_param2'"cam_param2""cam_param2""cam_param2""cam_param2""cam_param2", as well. Note that if the polynomial model is used to model the lens distortions, it is not possible to specify the values 'k1'"k1""k1""k1""k1""k1", 'k2'"k2""k2""k2""k2""k2", 'k3'"k3""k3""k3""k3""k3", 'p1'"p1""p1""p1""p1""p1", and 'p2'"p2""p2""p2""p2""p2" individually. They can only be specified in the following groups (with 'i'"i""i""i""i""i" indicating the index of the camera):

'poly_i':

'k1_i'"k1_i""k1_i""k1_i""k1_i""k1_i", 'k2_i'"k2_i""k2_i""k2_i""k2_i""k2_i", 'k3_i'"k3_i""k3_i""k3_i""k3_i""k3_i", 'p1_i'"p1_i""p1_i""p1_i""p1_i""p1_i", and 'p2_i'"p2_i""p2_i""p2_i""p2_i""p2_i"

'poly_rad_2_i':

'k1_i'"k1_i""k1_i""k1_i""k1_i""k1_i"

'poly_rad_4_i':

'k1_i'"k1_i""k1_i""k1_i""k1_i""k1_i" and 'k2_i'"k2_i""k2_i""k2_i""k2_i""k2_i"

'poly_rad_6_i':

'k1_i'"k1_i""k1_i""k1_i""k1_i""k1_i", 'k2_i'"k2_i""k2_i""k2_i""k2_i""k2_i", and 'k3_i'"k3_i""k3_i""k3_i""k3_i""k3_i"

'poly_tan_2_i':

'p1_i'"p1_i""p1_i""p1_i""p1_i""p1_i" and 'p2_i'"p2_i""p2_i""p2_i""p2_i""p2_i"

In addition, parameters can be excluded from estimation by using the prefix ~. For example, the values ['pose1', '~transx1']["pose1", "~transx1"]["pose1", "~transx1"]["pose1", "~transx1"]["pose1", "~transx1"]["pose1", "~transx1"] have the same effect as ['alpha1','beta1','gamma1','transy1','transz1']["alpha1","beta1","gamma1","transy1","transz1"]["alpha1","beta1","gamma1","transy1","transz1"]["alpha1","beta1","gamma1","transy1","transz1"]["alpha1","beta1","gamma1","transy1","transz1"]["alpha1","beta1","gamma1","transy1","transz1"]. Whereas ['all','~focus1']["all","~focus1"]["all","~focus1"]["all","~focus1"]["all","~focus1"]["all","~focus1"] determines all internal and external parameters except the focus of camera 1, for instance. The prefix ~ can be used with all parameter values except 'all', 'poly_rad_2_i' and 'poly_rad_4_i'.

The underlying camera model is explained in the description of the camera_calibrationcamera_calibrationCameraCalibrationcamera_calibrationCameraCalibrationCameraCalibration operator. It is specified by the parameters [focus1, kappa1, sx1, sy1, cx1, cy1, image_width1, image_height1] of camera 1 returned in CamParam1CamParam1CamParam1CamParam1CamParam1camParam1 and [focus2, kappa2, sx2, sy2, cx2, cy2, image_width2, image_height2] of camera 2 returned in CamParam2CamParam2CamParam2CamParam2CamParam2camParam2 (with focus > 0). The external parameters [transx_rel, transy_rel, transz_rel, alpha_rel, beta_rel, gamma_rel] are returned in RelPoseRelPoseRelPoseRelPoseRelPoserelPose and specify the 3D transformation of points of CCS 2 into CCS 1. Note that according to the description of poses at create_posecreate_poseCreatePosecreate_poseCreatePoseCreatePose one parameter is appended to the pose tuple at the last position to define the representation type of this pose.

According to camera_calibrationcamera_calibrationCameraCalibrationcamera_calibrationCameraCalibrationCameraCalibration the 3D transformation poses of the calibration model to the respective CCS are returned in NFinalPose1NFinalPose1NFinalPose1NFinalPose1NFinalPose1NFinalPose1 and NFinalPose2NFinalPose2NFinalPose2NFinalPose2NFinalPose2NFinalPose2. These transformations are related to RelPoseRelPoseRelPoseRelPoseRelPoserelPose according to the following equation (neglecting differences due to the balancing effects of the multi image calibration):

 HomMat3D_NFinalPose2 = INV(HomMat3D_RelPose) * HomMat3D_NFinalPose1 ,

whereas HomMat3D_* denotes a homogeneous transformation matrix of the respective poses and INV() inverts a homogeneous matrix.

The computed average errors returned in ErrorsErrorsErrorsErrorsErrorserrors give an impression of the accuracy of the calibration. Using the determined camera parameters they denote the average euclidean distance between the projection of the mark centers to their extracted image coordinates.

For cameras with telecentric lenses, additional conditions must be fulfilled for the setup. They can be found in the documentation of calibrate_camerascalibrate_camerasCalibrateCamerascalibrate_camerasCalibrateCamerasCalibrateCameras.

Parallelization

Parameters

NXNXNXNXNXNX (input_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered Tuple with all X-coordinates of the calibration marks (in meters).

NYNYNYNYNYNY (input_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered Tuple with all Y-coordinates of the calibration marks (in meters).

NZNZNZNZNZNZ (input_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered Tuple with all Z-coordinates of the calibration marks (in meters).

NRow1NRow1NRow1NRow1NRow1NRow1 (input_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered Tuple with all row-coordinates of the extracted calibration marks of camera 1 (in pixels).

NCol1NCol1NCol1NCol1NCol1NCol1 (input_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered Tuple with all column-coordinates of the extracted calibration marks of camera 1 (in pixels).

NRow2NRow2NRow2NRow2NRow2NRow2 (input_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered Tuple with all row-coordinates of the extracted calibration marks of camera 2 (in pixels).

NCol2NCol2NCol2NCol2NCol2NCol2 (input_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered Tuple with all column-coordinates of the extracted calibration marks of camera 2 (in pixels).

StartCamParam1StartCamParam1StartCamParam1StartCamParam1StartCamParam1startCamParam1 (input_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Initial values for the internal projective parameters of the projective camera 1.

Number of elements: StartCamParam1 == 8 || StartCamParam1 == 12 || StartCamParam1 == StartCamParam2

StartCamParam2StartCamParam2StartCamParam2StartCamParam2StartCamParam2startCamParam2 (input_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Initial values for the internal projective parameters of the projective camera 2.

Number of elements: StartCamParam2 == 8 || StartCamParam2 == 12 || StartCamParam2 == StartCamParam1

NStartPose1NStartPose1NStartPose1NStartPose1NStartPose1NStartPose1 (input_control)  pose(-array) HPose, HTupleHTupleHTupleHPoseX, VARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered tuple with all initial values for the poses of the calibration model in relation to camera 1.

NStartPose2NStartPose2NStartPose2NStartPose2NStartPose2NStartPose2 (input_control)  pose(-array) HPose, HTupleHTupleHTupleHPoseX, VARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered tuple with all initial values for the poses of the calibration model in relation to camera 2.

EstimateParamsEstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams (input_control)  string(-array) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Camera parameters to be estimated.

Default value: 'all' "all" "all" "all" "all" "all"

List of values: 'all'"all""all""all""all""all", 'alpha1'"alpha1""alpha1""alpha1""alpha1""alpha1", 'alpha2'"alpha2""alpha2""alpha2""alpha2""alpha2", 'beta1'"beta1""beta1""beta1""beta1""beta1", 'beta2'"beta2""beta2""beta2""beta2""beta2", 'cam_param1'"cam_param1""cam_param1""cam_param1""cam_param1""cam_param1", 'cam_param2'"cam_param2""cam_param2""cam_param2""cam_param2""cam_param2", 'cx1'"cx1""cx1""cx1""cx1""cx1", 'cx2'"cx2""cx2""cx2""cx2""cx2", 'cy1'"cy1""cy1""cy1""cy1""cy1", 'cy2'"cy2""cy2""cy2""cy2""cy2", 'focus1'"focus1""focus1""focus1""focus1""focus1", 'focus2'"focus2""focus2""focus2""focus2""focus2", 'gamma1'"gamma1""gamma1""gamma1""gamma1""gamma1", 'gamma2'"gamma2""gamma2""gamma2""gamma2""gamma2", 'kappa1'"kappa1""kappa1""kappa1""kappa1""kappa1", 'kappa2'"kappa2""kappa2""kappa2""kappa2""kappa2", 'poly_1'"poly_1""poly_1""poly_1""poly_1""poly_1", 'poly_2'"poly_2""poly_2""poly_2""poly_2""poly_2", 'poly_rad_2_1'"poly_rad_2_1""poly_rad_2_1""poly_rad_2_1""poly_rad_2_1""poly_rad_2_1", 'poly_rad_2_2'"poly_rad_2_2""poly_rad_2_2""poly_rad_2_2""poly_rad_2_2""poly_rad_2_2", 'poly_rad_4_1'"poly_rad_4_1""poly_rad_4_1""poly_rad_4_1""poly_rad_4_1""poly_rad_4_1", 'poly_rad_4_2'"poly_rad_4_2""poly_rad_4_2""poly_rad_4_2""poly_rad_4_2""poly_rad_4_2", 'poly_rad_6_1'"poly_rad_6_1""poly_rad_6_1""poly_rad_6_1""poly_rad_6_1""poly_rad_6_1", 'poly_rad_6_2'"poly_rad_6_2""poly_rad_6_2""poly_rad_6_2""poly_rad_6_2""poly_rad_6_2", 'poly_tan_2_1'"poly_tan_2_1""poly_tan_2_1""poly_tan_2_1""poly_tan_2_1""poly_tan_2_1", 'poly_tan_2_2'"poly_tan_2_2""poly_tan_2_2""poly_tan_2_2""poly_tan_2_2""poly_tan_2_2", 'pose1'"pose1""pose1""pose1""pose1""pose1", 'pose2'"pose2""pose2""pose2""pose2""pose2", 'pose_rel'"pose_rel""pose_rel""pose_rel""pose_rel""pose_rel", 'sx1'"sx1""sx1""sx1""sx1""sx1", 'sx2'"sx2""sx2""sx2""sx2""sx2", 'sy1'"sy1""sy1""sy1""sy1""sy1", 'sy2'"sy2""sy2""sy2""sy2""sy2", 'transx1'"transx1""transx1""transx1""transx1""transx1", 'transx2'"transx2""transx2""transx2""transx2""transx2", 'transy1'"transy1""transy1""transy1""transy1""transy1", 'transy2'"transy2""transy2""transy2""transy2""transy2", 'transz1'"transz1""transz1""transz1""transz1""transz1", 'transz2'"transz2""transz2""transz2""transz2""transz2"

CamParam1CamParam1CamParam1CamParam1CamParam1camParam1 (output_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Internal Parameters of the projective camera 1.

CamParam2CamParam2CamParam2CamParam2CamParam2camParam2 (output_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Internal parameters of the projective camera 2.

NFinalPose1NFinalPose1NFinalPose1NFinalPose1NFinalPose1NFinalPose1 (output_control)  pose(-array) HPose, HTupleHTupleHTupleHPoseX, VARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered tuple with all poses of the calibration model in relation to camera 1.

NFinalPose2NFinalPose2NFinalPose2NFinalPose2NFinalPose2NFinalPose2 (output_control)  pose(-array) HPose, HTupleHTupleHTupleHPoseX, VARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Ordered tuple with all poses of the calibration model in relation to camera 2.

RelPoseRelPoseRelPoseRelPoseRelPoserelPose (output_control)  pose HPose, HTupleHTupleHTupleHPoseX, VARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Pose of camera 2 in relation to camera 1.

ErrorsErrorsErrorsErrorsErrorserrors (output_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Average error distances in pixels.

Example (HDevelop)

* open image source
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, \
                   'default', 'images_l.seq', 'default', 0, -1, AcqHandle1)
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, \
                   'default', 'images_r.seq', 'default', 1, -1, AcqHandle2)

* initialize the start parameters
create_caltab (0.03, 'caltab_30.descr', 'caltab_30.ps')
caltab_points ('caltab_30.descr', X, Y, Z)
StartCamParam1 := [0.0125, 0, 7.4e-6, 7.4e-6, Width/2.0, Height/2.0, \
                   Width, Height]
StartCamParam2 := StartCamParam1
Rows1 := []
Cols1 := []
StartPoses1 := []
Rows2 := []
Cols2 := []
StartPoses2 := []

* find calibration marks and startposes
for i := 0 to 11 by 1
  grab_image_async (Image1, AcqHandle1, -1)
  grab_image_async (Image2, AcqHandle2, -1)
  find_caltab (Image1, Caltab1, 'caltab_30.descr', 3, 120, 5)
  find_caltab (Image2, Caltab2, 'caltab_30.descr', 3, 120, 5)
  find_marks_and_pose (Image1, Caltab1, 'caltab_30.descr', StartCamParam1, \
                       128, 10, 20, 0.7, 5, 100, RCoord1, CCoord1, \
                       StartPose1)
  Rows1 := [Rows1,RCoord1]
  Cols1 := [Cols1,CCoord1]
  StartPoses1 := [StartPoses1,StartPose1]
  find_marks_and_pose (Image2, Caltab2, 'caltab_30.descr', StartCamParam2, \
                       128, 10, 20, 0.7, 5, 100, RCoord2, CCoord2, \
                       StartPose2)
  Rows2 := [Rows2,RCoord2]
  Cols2 := [Cols2,CCoord2]
  StartPoses2 := [StartPoses2,StartPose2]
endfor

* calibrate the stereo rig
binocular_calibration (X, Y, Z, Rows1, Cols1, Rows2, Cols2, StartCamParam1, \
                       StartCamParam2, StartPoses1, StartPoses2, 'all', \
                       CamParam1, CamParam2, NFinalPose1, NFinalPose2, \
                       RelPose, Errors)
* archive the results
write_cam_par (CamParam1, 'cam_left-125.dat')
write_cam_par (CamParam2, 'cam_right-125.dat')
write_pose (RelPose, 'rel_pose.dat')

* rectify the stereo images
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, RelPose, \
  1,'geometric', 'bilinear', CamParamRect1, CamParamRect2, Cam1PoseRect1, \
  Cam2PoseRect2, RelPoseRect)
map_image (Image1, Map1, ImageMapped1)
map_image (Image2, Map2, ImageMapped2)

Example (HDevelop)

* open image source
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, \
                   'default', 'images_l.seq', 'default', 0, -1, AcqHandle1)
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, \
                   'default', 'images_r.seq', 'default', 1, -1, AcqHandle2)

* initialize the start parameters
create_caltab (0.03, 'caltab_30.descr', 'caltab_30.ps')
caltab_points ('caltab_30.descr', X, Y, Z)
StartCamParam1 := [0.0125, 0, 7.4e-6, 7.4e-6, Width/2.0, Height/2.0, \
                   Width, Height]
StartCamParam2 := StartCamParam1
Rows1 := []
Cols1 := []
StartPoses1 := []
Rows2 := []
Cols2 := []
StartPoses2 := []

* find calibration marks and startposes
for i := 0 to 11 by 1
  grab_image_async (Image1, AcqHandle1, -1)
  grab_image_async (Image2, AcqHandle2, -1)
  find_caltab (Image1, Caltab1, 'caltab_30.descr', 3, 120, 5)
  find_caltab (Image2, Caltab2, 'caltab_30.descr', 3, 120, 5)
  find_marks_and_pose (Image1, Caltab1, 'caltab_30.descr', StartCamParam1, \
                       128, 10, 20, 0.7, 5, 100, RCoord1, CCoord1, \
                       StartPose1)
  Rows1 := [Rows1,RCoord1]
  Cols1 := [Cols1,CCoord1]
  StartPoses1 := [StartPoses1,StartPose1]
  find_marks_and_pose (Image2, Caltab2, 'caltab_30.descr', StartCamParam2, \
                       128, 10, 20, 0.7, 5, 100, RCoord2, CCoord2, \
                       StartPose2)
  Rows2 := [Rows2,RCoord2]
  Cols2 := [Cols2,CCoord2]
  StartPoses2 := [StartPoses2,StartPose2]
endfor

* calibrate the stereo rig
binocular_calibration (X, Y, Z, Rows1, Cols1, Rows2, Cols2, StartCamParam1, \
                       StartCamParam2, StartPoses1, StartPoses2, 'all', \
                       CamParam1, CamParam2, NFinalPose1, NFinalPose2, \
                       RelPose, Errors)
* archive the results
write_cam_par (CamParam1, 'cam_left-125.dat')
write_cam_par (CamParam2, 'cam_right-125.dat')
write_pose (RelPose, 'rel_pose.dat')

* rectify the stereo images
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, RelPose, \
  1,'geometric', 'bilinear', CamParamRect1, CamParamRect2, Cam1PoseRect1, \
  Cam2PoseRect2, RelPoseRect)
map_image (Image1, Map1, ImageMapped1)
map_image (Image2, Map2, ImageMapped2)

Example (HDevelop)

* open image source
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, \
                   'default', 'images_l.seq', 'default', 0, -1, AcqHandle1)
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, \
                   'default', 'images_r.seq', 'default', 1, -1, AcqHandle2)

* initialize the start parameters
create_caltab (0.03, 'caltab_30.descr', 'caltab_30.ps')
caltab_points ('caltab_30.descr', X, Y, Z)
StartCamParam1 := [0.0125, 0, 7.4e-6, 7.4e-6, Width/2.0, Height/2.0, \
                   Width, Height]
StartCamParam2 := StartCamParam1
Rows1 := []
Cols1 := []
StartPoses1 := []
Rows2 := []
Cols2 := []
StartPoses2 := []

* find calibration marks and startposes
for i := 0 to 11 by 1
  grab_image_async (Image1, AcqHandle1, -1)
  grab_image_async (Image2, AcqHandle2, -1)
  find_caltab (Image1, Caltab1, 'caltab_30.descr', 3, 120, 5)
  find_caltab (Image2, Caltab2, 'caltab_30.descr', 3, 120, 5)
  find_marks_and_pose (Image1, Caltab1, 'caltab_30.descr', StartCamParam1, \
                       128, 10, 20, 0.7, 5, 100, RCoord1, CCoord1, \
                       StartPose1)
  Rows1 := [Rows1,RCoord1]
  Cols1 := [Cols1,CCoord1]
  StartPoses1 := [StartPoses1,StartPose1]
  find_marks_and_pose (Image2, Caltab2, 'caltab_30.descr', StartCamParam2, \
                       128, 10, 20, 0.7, 5, 100, RCoord2, CCoord2, \
                       StartPose2)
  Rows2 := [Rows2,RCoord2]
  Cols2 := [Cols2,CCoord2]
  StartPoses2 := [StartPoses2,StartPose2]
endfor

* calibrate the stereo rig
binocular_calibration (X, Y, Z, Rows1, Cols1, Rows2, Cols2, StartCamParam1, \
                       StartCamParam2, StartPoses1, StartPoses2, 'all', \
                       CamParam1, CamParam2, NFinalPose1, NFinalPose2, \
                       RelPose, Errors)
* archive the results
write_cam_par (CamParam1, 'cam_left-125.dat')
write_cam_par (CamParam2, 'cam_right-125.dat')
write_pose (RelPose, 'rel_pose.dat')

* rectify the stereo images
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, RelPose, \
  1,'geometric', 'bilinear', CamParamRect1, CamParamRect2, Cam1PoseRect1, \
  Cam2PoseRect2, RelPoseRect)
map_image (Image1, Map1, ImageMapped1)
map_image (Image2, Map2, ImageMapped2)

Example (C++ (HALCON 5.0-10.0))

HTuple   AcqHandle1, AcqHandle2;
HTuple   X, Y, Z, StartCamParam1, StartCamParam2;
HTuple   Rows1, Cols1, StartPoses1, Rows2, Cols2, StartPoses2;
HTuple   i, RCoord1, CCoord1, StartPose1, RCoord2, CCoord2;
HTuple   StartPose2, CamParam1, CamParam2, NFinalPose1, NFinalPose2;
HTuple   c1Pc2, Errors, CamParamRect1, CamParamRect2, CamPoseRect1;
HTuple   CamPoseRect2, RelPoseRect;
Hobject  Image1, Image2, Caltab1, Caltab2, Map1, Map2, ImageMapped1;
Hobject  ImageMapped2;

// open image source
open_framegrabber("File",1,1,0,0,0,0,"default",-1,"default",-1,"default",
                  "images_l.seq","default",0,-1,&AcqHandle1);
open_framegrabber("File",1,1,0,0,0,0,"default",-1,"default",-1,"default",
                  "images_r.seq","default",0,-1,&AcqHandle2);
// initialize the start parameters
caltab_points("caltab_30mm.descr",&X,&Y,&Z);
StartCamParam1[7] = 640;          // ImageHeight
StartCamParam1[6] = 480;          // ImageWidth
StartCamParam1[5] = 320;          // Cy
StartCamParam1[4] = 240;          // Cx
StartCamParam1[3] = 7.4e-6;       // Sy
StartCamParam1[2] = 7.4e-6;       // Sx
StartCamParam1[1] = 0.0;          // Kappa
StartCamParam1[0] = 0.0125;       // Focus
StartCamParam2 = StartCamParam1;    // identic camera
Rows1 = HTuple();
Cols1 = HTuple();
StartPoses1 = HTuple();
Rows2 = HTuple();
Cols2 = HTuple();
StartPoses2 = HTuple();

// find calibration marks and startposes
for (i=0; i<=11; i+=1)
{
  grab_image_async(&Image1,AcqHandle1,-1);
  grab_image_async(&Image2,AcqHandle2,-1);
  find_caltab(Image1,&Caltab1,"caltab_30mm.descr",3,120,5);
  find_caltab(Image2,&Caltab2,"caltab_30mm.descr",3,120,5);
  find_marks_and_pose(Image1,Caltab1,"caltab_30.descr",StartCamParam1,128,
                      10,20,0.7,5,100,&RCoord1,&CCoord1,&StartPose1);
  Rows1.Append(RCoord1);
  Cols1.Append(CCoord1);
  StartPoses1.Append(StartPose1);
  find_marks_and_pose(Image2,Caltab2,"caltab_30mm.descr",StartCamParam2,128,
                      10,18,0.7,2,100,&RCoord2,&CCoord2,&StartPose2);
  Rows2.Append(RCoord2);
  Cols2.Append(CCoord2);
  StartPoses2.Append(StartPose2);
}

// find calibration marks and start poses
binocular_calibration(X,Y,Z,Rows1,Cols1,Rows2,Cols2,StartCamParam1,
                      StartCamParam2,StartPoses1,StartPoses2,"all",
                      &CamParam1,&CamParam2,&NFinalPose1,&NFinalPose2,
                      &RelPose,&Errors);
// archive the results
write_cam_par(CamParam1,"cam_left-125.dat");
write_cam_par(CamParam2,"cam_right-125.dat");
write_pose(RelPose,"rel_pose.dat");
// rectify the stereo images
gen_binocular_rectification_map(&Map1,&Map2,CamParam1,CamParam2,RelPose,1,
                                "geometric","bilinear",&CamParamRect1,
                                &CamParamRect2,&CamPoseRect1,
                                &CamPoseRect2,&RelPoseRect);
map_image(Image1,Map1,&ImageMapped1);
map_image(Image2,Map2,&ImageMapped2);

Example (HDevelop)

* open image source
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, \
                   'default', 'images_l.seq', 'default', 0, -1, AcqHandle1)
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, \
                   'default', 'images_r.seq', 'default', 1, -1, AcqHandle2)

* initialize the start parameters
create_caltab (0.03, 'caltab_30.descr', 'caltab_30.ps')
caltab_points ('caltab_30.descr', X, Y, Z)
StartCamParam1 := [0.0125, 0, 7.4e-6, 7.4e-6, Width/2.0, Height/2.0, \
                   Width, Height]
StartCamParam2 := StartCamParam1
Rows1 := []
Cols1 := []
StartPoses1 := []
Rows2 := []
Cols2 := []
StartPoses2 := []

* find calibration marks and startposes
for i := 0 to 11 by 1
  grab_image_async (Image1, AcqHandle1, -1)
  grab_image_async (Image2, AcqHandle2, -1)
  find_caltab (Image1, Caltab1, 'caltab_30.descr', 3, 120, 5)
  find_caltab (Image2, Caltab2, 'caltab_30.descr', 3, 120, 5)
  find_marks_and_pose (Image1, Caltab1, 'caltab_30.descr', StartCamParam1, \
                       128, 10, 20, 0.7, 5, 100, RCoord1, CCoord1, \
                       StartPose1)
  Rows1 := [Rows1,RCoord1]
  Cols1 := [Cols1,CCoord1]
  StartPoses1 := [StartPoses1,StartPose1]
  find_marks_and_pose (Image2, Caltab2, 'caltab_30.descr', StartCamParam2, \
                       128, 10, 20, 0.7, 5, 100, RCoord2, CCoord2, \
                       StartPose2)
  Rows2 := [Rows2,RCoord2]
  Cols2 := [Cols2,CCoord2]
  StartPoses2 := [StartPoses2,StartPose2]
endfor

* calibrate the stereo rig
binocular_calibration (X, Y, Z, Rows1, Cols1, Rows2, Cols2, StartCamParam1, \
                       StartCamParam2, StartPoses1, StartPoses2, 'all', \
                       CamParam1, CamParam2, NFinalPose1, NFinalPose2, \
                       RelPose, Errors)
* archive the results
write_cam_par (CamParam1, 'cam_left-125.dat')
write_cam_par (CamParam2, 'cam_right-125.dat')
write_pose (RelPose, 'rel_pose.dat')

* rectify the stereo images
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, RelPose, \
  1,'geometric', 'bilinear', CamParamRect1, CamParamRect2, Cam1PoseRect1, \
  Cam2PoseRect2, RelPoseRect)
map_image (Image1, Map1, ImageMapped1)
map_image (Image2, Map2, ImageMapped2)

Example (HDevelop)

* open image source
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, \
                   'default', 'images_l.seq', 'default', 0, -1, AcqHandle1)
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, 'default', -1, \
                   'default', 'images_r.seq', 'default', 1, -1, AcqHandle2)

* initialize the start parameters
create_caltab (0.03, 'caltab_30.descr', 'caltab_30.ps')
caltab_points ('caltab_30.descr', X, Y, Z)
StartCamParam1 := [0.0125, 0, 7.4e-6, 7.4e-6, Width/2.0, Height/2.0, \
                   Width, Height]
StartCamParam2 := StartCamParam1
Rows1 := []
Cols1 := []
StartPoses1 := []
Rows2 := []
Cols2 := []
StartPoses2 := []

* find calibration marks and startposes
for i := 0 to 11 by 1
  grab_image_async (Image1, AcqHandle1, -1)
  grab_image_async (Image2, AcqHandle2, -1)
  find_caltab (Image1, Caltab1, 'caltab_30.descr', 3, 120, 5)
  find_caltab (Image2, Caltab2, 'caltab_30.descr', 3, 120, 5)
  find_marks_and_pose (Image1, Caltab1, 'caltab_30.descr', StartCamParam1, \
                       128, 10, 20, 0.7, 5, 100, RCoord1, CCoord1, \
                       StartPose1)
  Rows1 := [Rows1,RCoord1]
  Cols1 := [Cols1,CCoord1]
  StartPoses1 := [StartPoses1,StartPose1]
  find_marks_and_pose (Image2, Caltab2, 'caltab_30.descr', StartCamParam2, \
                       128, 10, 20, 0.7, 5, 100, RCoord2, CCoord2, \
                       StartPose2)
  Rows2 := [Rows2,RCoord2]
  Cols2 := [Cols2,CCoord2]
  StartPoses2 := [StartPoses2,StartPose2]
endfor

* calibrate the stereo rig
binocular_calibration (X, Y, Z, Rows1, Cols1, Rows2, Cols2, StartCamParam1, \
                       StartCamParam2, StartPoses1, StartPoses2, 'all', \
                       CamParam1, CamParam2, NFinalPose1, NFinalPose2, \
                       RelPose, Errors)
* archive the results
write_cam_par (CamParam1, 'cam_left-125.dat')
write_cam_par (CamParam2, 'cam_right-125.dat')
write_pose (RelPose, 'rel_pose.dat')

* rectify the stereo images
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, RelPose, \
  1,'geometric', 'bilinear', CamParamRect1, CamParamRect2, Cam1PoseRect1, \
  Cam2PoseRect2, RelPoseRect)
map_image (Image1, Map1, ImageMapped1)
map_image (Image2, Map2, ImageMapped2)

Result

binocular_calibrationbinocular_calibrationBinocularCalibrationbinocular_calibrationBinocularCalibrationBinocularCalibration returns 2 (H_MSG_TRUE) if all parameter values are correct and the desired parameters have been determined by the minimization algorithm. If necessary, an exception is raised.

Possible Predecessors

find_marks_and_posefind_marks_and_poseFindMarksAndPosefind_marks_and_poseFindMarksAndPoseFindMarksAndPose, caltab_pointscaltab_pointsCaltabPointscaltab_pointsCaltabPointsCaltabPoints, read_cam_parread_cam_parReadCamParread_cam_parReadCamParReadCamPar

Possible Successors

write_posewrite_poseWritePosewrite_poseWritePoseWritePose, write_cam_parwrite_cam_parWriteCamParwrite_cam_parWriteCamParWriteCamPar, pose_to_hom_mat3dpose_to_hom_mat3dPoseToHomMat3dpose_to_hom_mat3dPoseToHomMat3dPoseToHomMat3d, disp_caltabdisp_caltabDispCaltabdisp_caltabDispCaltabDispCaltab, gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMap

See also

find_caltabfind_caltabFindCaltabfind_caltabFindCaltabFindCaltab, sim_caltabsim_caltabSimCaltabsim_caltabSimCaltabSimCaltab, read_cam_parread_cam_parReadCamParread_cam_parReadCamParReadCamPar, create_posecreate_poseCreatePosecreate_poseCreatePoseCreatePose, convert_pose_typeconvert_pose_typeConvertPoseTypeconvert_pose_typeConvertPoseTypeConvertPoseType, read_poseread_poseReadPoseread_poseReadPoseReadPose, hom_mat3d_to_posehom_mat3d_to_poseHomMat3dToPosehom_mat3d_to_poseHomMat3dToPoseHomMat3dToPose, create_caltabcreate_caltabCreateCaltabcreate_caltabCreateCaltabCreateCaltab, binocular_disparitybinocular_disparityBinocularDisparitybinocular_disparityBinocularDisparityBinocularDisparity, binocular_distancebinocular_distanceBinocularDistancebinocular_distanceBinocularDistanceBinocularDistance

Module

3D Metrology


ClassesClassesClassesClasses | | | | Operators