binocular_calibrationT_binocular_calibrationBinocularCalibrationBinocularCalibrationbinocular_calibration双目标定(算子)

名称

binocular_calibrationT_binocular_calibrationBinocularCalibrationBinocularCalibrationbinocular_calibration — 确定双目立体系统的所有相机参数。

签名

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)

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)

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

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

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

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

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)

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

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

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

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

def binocular_calibration(nx: Sequence[Union[float, int]], ny: Sequence[Union[float, int]], nz: Sequence[Union[float, int]], nrow_1: Sequence[Union[float, int]], ncol_1: Sequence[Union[float, int]], nrow_2: Sequence[Union[float, int]], ncol_2: Sequence[Union[float, int]], start_cam_param_1: Sequence[Union[float, int, str]], start_cam_param_2: Sequence[Union[float, int, str]], nstart_pose_1: Sequence[Union[float, int]], nstart_pose_2: Sequence[Union[float, int]], estimate_params: Sequence[str]) -> Tuple[Sequence[Union[float, int, str]], Sequence[Union[float, int, str]], Sequence[Union[float, int]], Sequence[Union[float, int]], Sequence[Union[float, int]], Sequence[float]]

def binocular_calibration_s(nx: Sequence[Union[float, int]], ny: Sequence[Union[float, int]], nz: Sequence[Union[float, int]], nrow_1: Sequence[Union[float, int]], ncol_1: Sequence[Union[float, int]], nrow_2: Sequence[Union[float, int]], ncol_2: Sequence[Union[float, int]], start_cam_param_1: Sequence[Union[float, int, str]], start_cam_param_2: Sequence[Union[float, int, str]], nstart_pose_1: Sequence[Union[float, int]], nstart_pose_2: Sequence[Union[float, int]], estimate_params: Sequence[str]) -> Tuple[Sequence[Union[float, int, str]], Sequence[Union[float, int, str]], Sequence[Union[float, int]], Sequence[Union[float, int]], Sequence[Union[float, int]], float]

描述

一般而言,双目标定是指精确确定用于建模的参数,这些参数通过双目立体系统中对应图像实现三维点的三维重建。该重建过程由内部参数(相机 1 的 CamParam1CamParam1CamParam1CamParam1camParam1cam_param_1 和相机 2 的 CamParam2CamParam2CamParam2CamParam2camParam2cam_param_2 )定义,这些参数描述了底层相机模型;同时由外部参数 RelPoseRelPoseRelPoseRelPoserelPoserel_pose 定义,该参数描述了相机系统 2 相对于相机系统 1 的相对姿态。

因此,已知的三维模型点(坐标为 NXNXNXNXNXnxNYNYNYNYNYnyNZNZNZNZNZnz)被投影到两台相机(相机 1 和相机 2)的图像平面中,通过最小化这些投影与对应测量图像点(相机 1 的坐标为 NRow1NRow1NRow1NRow1NRow1nrow_1NCol1NCol1NCol1NCol1NCol1ncol_1,相机 2 的坐标为 NRow2NRow2NRow2NRow2NRow2nrow_2NCol2NCol2NCol2NCol2NCol2ncol_2)之间的距离平方和来实现。需注意所有模型点必须同时出现在两幅图像中。所用相机模型详见 标定。该模型通过 9 至 16 个参数组成的元组分别描述每台相机,对应透视、远心面扫描或远心线扫描相机(参见 标定)。投影使用相机 1 和相机 2 内部参数的初始值 StartCamParam1StartCamParam1StartCamParam1StartCamParam1startCamParam1start_cam_param_1StartCamParam2StartCamParam2StartCamParam2StartCamParam2startCamParam2start_cam_param_2,这些参数可从相机数据手册中获取。此外,还需提供三维标定模型姿态相对于相机 1 和相机 2 相机坐标系(ccs)的初始估计值 NStartPose1NStartPose1NStartPose1NStartPose1NStartPose1nstart_pose_1NStartPose2NStartPose2NStartPose2NStartPose2NStartPose2nstart_pose_2。这些姿态应采用 格式,其中 wcs 表示世界坐标系(参见 变换 / 姿态“解决方案指南III-C - 三维视觉”)。这些参数可通过 find_marks_and_posefind_marks_and_poseFindMarksAndPoseFindMarksAndPoseFindMarksAndPosefind_marks_and_pose 算子确定。由于该标定算法同时处理来自不同图像对的测量图像与已知模型点之间的对应关系,必须按对应顺序将姿态(NStartPose1NStartPose1NStartPose1NStartPose1NStartPose1nstart_pose_1,NStartPose2NStartPose2NStartPose2NStartPose2NStartPose2nstart_pose_2)与测量点(NRow1NRow1NRow1NRow1NRow1nrow_1,NCol1NCol1NCol1NCol1NCol1ncol_1,NRow2NRow2NRow2NRow2NRow2nrow_2, NCol2NCol2NCol2NCol2NCol2ncol_2)拼接后传递。

输入参数 EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParamsestimate_params 用于选择待估计的参数。通常该参数设置为 'all'"all""all""all""all""all",即确定所有外部相机参数(平移和旋转)及所有内部相机参数。否则,EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParamsestimate_params 包含一个字符串元组,指示待估计参数的组合。例如,如果相机内部参数已通过先前调用 binocular_calibrationbinocular_calibrationBinocularCalibrationBinocularCalibrationBinocularCalibrationbinocular_calibration 等方法确定,通常只需估算两台相机之间的相对姿态(RelPoseRelPoseRelPoseRelPoserelPoserel_pose)。在此情况下, EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParamsestimate_params 可设置为 'pose_rel'"pose_rel""pose_rel""pose_rel""pose_rel""pose_rel"。内部参数也可由参数值 'cam_param1'"cam_param1""cam_param1""cam_param1""cam_param1""cam_param1"'cam_param2'"cam_param2""cam_param2""cam_param2""cam_param2""cam_param2" 涵盖。需注意:若采用多项式模型描述镜头畸变,则 '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'"p1""p1""p1""p1""p1" and 'p2'"p2""p2""p2""p2""p2" 仅能在 'poly_tan_2_i'"poly_tan_2_i""poly_tan_2_i""poly_tan_2_i""poly_tan_2_i""poly_tan_2_i" 级内设定(其中 'i'"i""i""i""i""i" 表示相机索引)。'poly_i'"poly_i""poly_i""poly_i""poly_i""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"'poly_tan_2_i'"poly_tan_2_i""poly_tan_2_i""poly_tan_2_i""poly_tan_2_i""poly_tan_2_i"

以下列表包含可传递给元组的所有可能字符串:

EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParamsestimate_params允许的字符串 确定的参数
'all' (default) 所有内部相机参数,以及两台相机的相对姿态和标定目标的姿态。
'pose' 两台相机之间的相对姿态以及标定目标的姿态。
'pose_rel' 两台相机之间的相对姿态。
'alpha_rel', 'beta_rel', 'gamma_rel', 'transx_rel', 'transy_rel', 'transz_rel' 两台相机之间相对姿态的旋转角度与平移参数。
'pose_caltabs' 标定目标的姿势。
'alpha_caltabs', 'beta_caltabs', 'gamma_caltabs', 'transx_caltabs', 'transy_caltabs', 'transz_caltabs' 标定目标相对姿态的旋转角度与平移参数。
'cam_param1', 'cam_param2' 相机 1 和相机 2 各自的所有内部相机参数。
'focus1', 'magnification1', 'kappa1', 'poly_1', 'k1_1', 'k2_1', 'k3_1', 'poly_tan_2_1', 'image_plane_dist1', 'tilt1', 'cx1', 'cy1', 'sx1', 'sy1', 'focus2', 'magnification2', 'kappa2', 'poly_2', 'k1_2', 'k2_2', 'k3_2', 'poly_tan_2_2', 'image_plane_dist2', 'tilt2', 'cx2', 'cy2', 'sx2', 'sy2' 相机 1 和相机 2 各自的单个内部相机参数。
'common_motion_vector' 判断两台线扫描相机是否具有共同运动向量。当两台相机刚性安装且物体在相机前方作线性移动时,或当两台刚性安装的相机由同一线性执行器驱动移动时,即满足此条件。此为默认假设。因此,仅当相机在不同方向独立移动时,才需设置“~common_motion_vector”参数。

此外,可通过使用前缀“~”将参数排除在估计范围之外。例如,值 ['pose_rel', '~transx_rel']["pose_rel", "~transx_rel"]["pose_rel", "~transx_rel"]["pose_rel", "~transx_rel"]["pose_rel", "~transx_rel"]["pose_rel", "~transx_rel"]['alpha_rel','beta_rel','gamma_rel','transy_rel','transz_rel']["alpha_rel","beta_rel","gamma_rel","transy_rel","transz_rel"]["alpha_rel","beta_rel","gamma_rel","transy_rel","transz_rel"]["alpha_rel","beta_rel","gamma_rel","transy_rel","transz_rel"]["alpha_rel","beta_rel","gamma_rel","transy_rel","transz_rel"]["alpha_rel","beta_rel","gamma_rel","transy_rel","transz_rel"] 具有相同效果。另一方面,如 ['all','~focus1']["all","~focus1"]["all","~focus1"]["all","~focus1"]["all","~focus1"]["all","~focus1"] 则表示除相机 1 的焦距外,确定所有内部和外部参数。除 'all'"all""all""all""all""all" 外,所有参数值均可使用前缀“~”。

底层相机模型在 标定 一章中有详细说明。校准后的内部相机参数通过 CamParam1CamParam1CamParam1CamParam1camParam1cam_param_1 返回(对应相机 1),通过 CamParam2CamParam2CamParam2CamParam2camParam2cam_param_2 返回(对应相机 2)。

外部参数的返回方式与 camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibrationcamera_calibration 类似,标定模型的三维变换姿态通过 NFinalPose1NFinalPose1NFinalPose1NFinalPose1NFinalPose1nfinal_pose_1NFinalPose2NFinalPose2NFinalPose2NFinalPose2NFinalPose2nfinal_pose_2 返回至对应的相机坐标系(ccs)。因此,姿态采用 形式,其中 wcs 表示三维标定模型的世界坐标系(参见 变换 / 姿态“解决方案指南 III-C - 三维视觉”)。相对姿态 RelPoseRelPoseRelPoseRelPoserelPoserel_pose)定义了将 ccs2 中点转换至 ccs1 的映射关系。由此,最终姿态间建立关联(忽略多图像标定平衡效应导致的差异): HomMat3D_NFinalPose2 = INV(HomMat3D_RelPose) * HomMat3D_NFinalPose1 , 其中 HomMat3D_* 表示相应姿态的齐次变换矩阵,而 INV() 对齐次矩阵进行求逆运算。

ErrorsErrorsErrorsErrorserrorserrors 中返回的计算平均误差可反映标定的精度。这些误差基于测得的相机参数,表示标记中心投影点与其提取图像坐标之间的平均欧几里得(Euclidean )距离。

对于配备远心镜头的相机,设置时必须满足额外的条件。这些条件详见 标定 一章。

注意

同时包含带超中心镜头和不带超中心镜头的相机的立体设置不受支持。此外,同时包含面扫描相机和线扫描相机的立体设置也不受支持。

执行信息

参数

NXNXNXNXNXnx (输入控制)  number-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

标定标记的所有 X 坐标(单位:米)的有序元组。

NYNYNYNYNYny (输入控制)  number-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

标定标记的所有 Y 坐标(单位:米)的有序元组。

元素数量: NY == NX

NZNZNZNZNZnz (输入控制)  number-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

标定标记的所有 Z 坐标(单位:米)的有序元组。

元素数量: NZ == NX

NRow1NRow1NRow1NRow1NRow1nrow_1 (输入控制)  number-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

包含相机 1 提取的标定标记所有行坐标(单位:像素)的有序元组。

NCol1NCol1NCol1NCol1NCol1ncol_1 (输入控制)  number-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

包含相机 1 提取的标定标记所有列坐标(单位:像素)的有序元组。

元素数量: NCol1 == NRow1

NRow2NRow2NRow2NRow2NRow2nrow_2 (输入控制)  number-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

包含相机 2 提取的标定标记所有行坐标(单位:像素)的有序元组。

元素数量: NRow2 == NRow1

NCol2NCol2NCol2NCol2NCol2ncol_2 (输入控制)  number-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

包含相机 2 提取的标定标记所有列坐标(单位:像素)的有序元组。

元素数量: NCol2 == NRow1

StartCamParam1StartCamParam1StartCamParam1StartCamParam1startCamParam1start_cam_param_1 (输入控制)  campar HCamPar, HTupleSequence[Union[float, int, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

相机 1 内部参数的初始值。

StartCamParam2StartCamParam2StartCamParam2StartCamParam2startCamParam2start_cam_param_2 (输入控制)  campar HCamPar, HTupleSequence[Union[float, int, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

相机 2 内部参数的初始值。

NStartPose1NStartPose1NStartPose1NStartPose1NStartPose1nstart_pose_1 (输入控制)  pose(-array) HPose, HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

标定模型相对于相机 1 的所有姿态初始值的有序元组。

元素数量: NStartPose1 == 7 * NRow1 / NX

NStartPose2NStartPose2NStartPose2NStartPose2NStartPose2nstart_pose_2 (输入控制)  pose(-array) HPose, HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

标定模型相对于相机 2 的所有姿态初始值的有序元组。

元素数量: NStartPose2 == 7 * NRow1 / NX

EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParamsestimate_params (输入控制)  string-array HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)

待估算的相机参数。

默认值: 'all' "all" "all" "all" "all" "all"

值列表: 'all'"all""all""all""all""all", 'alpha_caltabs'"alpha_caltabs""alpha_caltabs""alpha_caltabs""alpha_caltabs""alpha_caltabs", 'alpha_rel'"alpha_rel""alpha_rel""alpha_rel""alpha_rel""alpha_rel", 'beta_caltabs'"beta_caltabs""beta_caltabs""beta_caltabs""beta_caltabs""beta_caltabs", 'beta_rel'"beta_rel""beta_rel""beta_rel""beta_rel""beta_rel", 'cam_param1'"cam_param1""cam_param1""cam_param1""cam_param1""cam_param1", 'cam_param2'"cam_param2""cam_param2""cam_param2""cam_param2""cam_param2", 'common_motion_vector'"common_motion_vector""common_motion_vector""common_motion_vector""common_motion_vector""common_motion_vector", '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", 'gamma_caltabs'"gamma_caltabs""gamma_caltabs""gamma_caltabs""gamma_caltabs""gamma_caltabs", 'gamma_rel'"gamma_rel""gamma_rel""gamma_rel""gamma_rel""gamma_rel", 'image_plane_dist1'"image_plane_dist1""image_plane_dist1""image_plane_dist1""image_plane_dist1""image_plane_dist1", 'image_plane_dist2'"image_plane_dist2""image_plane_dist2""image_plane_dist2""image_plane_dist2""image_plane_dist2", 'k1_1'"k1_1""k1_1""k1_1""k1_1""k1_1", 'k1_2'"k1_2""k1_2""k1_2""k1_2""k1_2", 'k2_1'"k2_1""k2_1""k2_1""k2_1""k2_1", 'k2_2'"k2_2""k2_2""k2_2""k2_2""k2_2", 'k3_1'"k3_1""k3_1""k3_1""k3_1""k3_1", 'k3_2'"k3_2""k3_2""k3_2""k3_2""k3_2", 'kappa1'"kappa1""kappa1""kappa1""kappa1""kappa1", 'kappa2'"kappa2""kappa2""kappa2""kappa2""kappa2", 'magnification1'"magnification1""magnification1""magnification1""magnification1""magnification1", 'magnification2'"magnification2""magnification2""magnification2""magnification2""magnification2", '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_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", 'pose'"pose""pose""pose""pose""pose", 'pose_caltabs'"pose_caltabs""pose_caltabs""pose_caltabs""pose_caltabs""pose_caltabs", '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", 'tilt1'"tilt1""tilt1""tilt1""tilt1""tilt1", 'tilt2'"tilt2""tilt2""tilt2""tilt2""tilt2", 'transx_caltabs'"transx_caltabs""transx_caltabs""transx_caltabs""transx_caltabs""transx_caltabs", 'transx_rel'"transx_rel""transx_rel""transx_rel""transx_rel""transx_rel", 'transy_caltabs'"transy_caltabs""transy_caltabs""transy_caltabs""transy_caltabs""transy_caltabs", 'transy_rel'"transy_rel""transy_rel""transy_rel""transy_rel""transy_rel", 'transz_caltabs'"transz_caltabs""transz_caltabs""transz_caltabs""transz_caltabs""transz_caltabs", 'transz_rel'"transz_rel""transz_rel""transz_rel""transz_rel""transz_rel"

CamParam1CamParam1CamParam1CamParam1camParam1cam_param_1 (输出控制)  campar HCamPar, HTupleSequence[Union[float, int, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

相机 1 的内部参数。

CamParam2CamParam2CamParam2CamParam2camParam2cam_param_2 (输出控制)  campar HCamPar, HTupleSequence[Union[float, int, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

相机 2 的内部参数。

NFinalPose1NFinalPose1NFinalPose1NFinalPose1NFinalPose1nfinal_pose_1 (输出控制)  pose(-array) HPose, HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

标定模型相对于相机 1 的所有姿态的有序元组。

元素数量: NFinalPose1 == 7 * NRow1 / NX

NFinalPose2NFinalPose2NFinalPose2NFinalPose2NFinalPose2nfinal_pose_2 (输出控制)  pose(-array) HPose, HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

标定模型相对于相机 2 的所有姿态的有序元组。

元素数量: NFinalPose2 == 7 * NRow1 / NX

RelPoseRelPoseRelPoseRelPoserelPoserel_pose (输出控制)  pose HPose, HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

相机 2 相对于相机 1 的姿态。

ErrorsErrorsErrorsErrorserrorserrors (输出控制)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

平均误差距离(单位:像素)。

示例(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.
caltab_points ('caltab_30mm.descr', X, Y, Z)
StartCamParam1 := ['area_scan_division', 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, CalPlate1, 'caltab_30mm.descr', 3, 120, 5)
  find_caltab (Image2, CalPlate2, 'caltab_30mm.descr', 3, 120, 5)
  find_marks_and_pose (Image1, CalPlate1, 'caltab_30mm.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, CalPlate2, 'caltab_30mm.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, 'viewing_direction', 'bilinear', \
                                 CamParamRect1, CamParamRect2, \
                                 CamPoseRect1, CamPoseRect2, \
                                 RelPoseRect)
map_image (Image1, Map1, ImageMapped1)
map_image (Image2, Map2, ImageMapped2)

示例(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.
caltab_points ('caltab_30mm.descr', X, Y, Z)
StartCamParam1 := ['area_scan_division', 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, CalPlate1, 'caltab_30mm.descr', 3, 120, 5)
  find_caltab (Image2, CalPlate2, 'caltab_30mm.descr', 3, 120, 5)
  find_marks_and_pose (Image1, CalPlate1, 'caltab_30mm.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, CalPlate2, 'caltab_30mm.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, 'viewing_direction', 'bilinear', \
                                 CamParamRect1, CamParamRect2, \
                                 CamPoseRect1, CamPoseRect2, \
                                 RelPoseRect)
map_image (Image1, Map1, ImageMapped1)
map_image (Image2, Map2, ImageMapped2)

示例(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.
caltab_points ('caltab_30mm.descr', X, Y, Z)
StartCamParam1 := ['area_scan_division', 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, CalPlate1, 'caltab_30mm.descr', 3, 120, 5)
  find_caltab (Image2, CalPlate2, 'caltab_30mm.descr', 3, 120, 5)
  find_marks_and_pose (Image1, CalPlate1, 'caltab_30mm.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, CalPlate2, 'caltab_30mm.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, 'viewing_direction', 'bilinear', \
                                 CamParamRect1, CamParamRect2, \
                                 CamPoseRect1, CamPoseRect2, \
                                 RelPoseRect)
map_image (Image1, Map1, ImageMapped1)
map_image (Image2, Map2, ImageMapped2)

示例(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.
caltab_points ('caltab_30mm.descr', X, Y, Z)
StartCamParam1 := ['area_scan_division', 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, CalPlate1, 'caltab_30mm.descr', 3, 120, 5)
  find_caltab (Image2, CalPlate2, 'caltab_30mm.descr', 3, 120, 5)
  find_marks_and_pose (Image1, CalPlate1, 'caltab_30mm.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, CalPlate2, 'caltab_30mm.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, 'viewing_direction', 'bilinear', \
                                 CamParamRect1, CamParamRect2, \
                                 CamPoseRect1, CamPoseRect2, \
                                 RelPoseRect)
map_image (Image1, Map1, ImageMapped1)
map_image (Image2, Map2, ImageMapped2)

示例(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.
caltab_points ('caltab_30mm.descr', X, Y, Z)
StartCamParam1 := ['area_scan_division', 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, CalPlate1, 'caltab_30mm.descr', 3, 120, 5)
  find_caltab (Image2, CalPlate2, 'caltab_30mm.descr', 3, 120, 5)
  find_marks_and_pose (Image1, CalPlate1, 'caltab_30mm.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, CalPlate2, 'caltab_30mm.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, 'viewing_direction', 'bilinear', \
                                 CamParamRect1, CamParamRect2, \
                                 CamPoseRect1, CamPoseRect2, \
                                 RelPoseRect)
map_image (Image1, Map1, ImageMapped1)
map_image (Image2, Map2, ImageMapped2)

结果

binocular_calibrationbinocular_calibrationBinocularCalibrationBinocularCalibrationBinocularCalibrationbinocular_calibration 返回 2 ( H_MSG_TRUE ),表示所有参数值正确且所需参数已通过最小化算法确定。如有必要,则抛出异常。

可能的前趋

find_marks_and_posefind_marks_and_poseFindMarksAndPoseFindMarksAndPoseFindMarksAndPosefind_marks_and_pose, caltab_pointscaltab_pointsCaltabPointsCaltabPointsCaltabPointscaltab_points, read_cam_parread_cam_parReadCamParReadCamParReadCamParread_cam_par

可能的后继

write_posewrite_poseWritePoseWritePoseWritePosewrite_pose, write_cam_parwrite_cam_parWriteCamParWriteCamParWriteCamParwrite_cam_par, pose_to_hom_mat3dpose_to_hom_mat3dPoseToHomMat3dPoseToHomMat3dPoseToHomMat3dpose_to_hom_mat3d, disp_caltabdisp_caltabDispCaltabDispCaltabDispCaltabdisp_caltab, gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapGenBinocularRectificationMapgen_binocular_rectification_map

另见

find_caltabfind_caltabFindCaltabFindCaltabFindCaltabfind_caltab, sim_caltabsim_caltabSimCaltabSimCaltabSimCaltabsim_caltab, read_cam_parread_cam_parReadCamParReadCamParReadCamParread_cam_par, create_posecreate_poseCreatePoseCreatePoseCreatePosecreate_pose, convert_pose_typeconvert_pose_typeConvertPoseTypeConvertPoseTypeConvertPoseTypeconvert_pose_type, read_poseread_poseReadPoseReadPoseReadPoseread_pose, hom_mat3d_to_posehom_mat3d_to_poseHomMat3dToPoseHomMat3dToPoseHomMat3dToPosehom_mat3d_to_pose, create_caltabcreate_caltabCreateCaltabCreateCaltabCreateCaltabcreate_caltab, binocular_disparitybinocular_disparityBinocularDisparityBinocularDisparityBinocularDisparitybinocular_disparity, binocular_distancebinocular_distanceBinocularDistanceBinocularDistanceBinocularDistancebinocular_distance

模块

三维计量