calibration procedure.
This is done by computing a pose which is oriented such that the plane defined by z=0 coincides with the light plane.
*通过计算一个面向z=0的平面的位姿来确定
respect to the world coordinate system.
find_calib_object (CaltabImagePos20, CalibDataID, 0, 0, NumCalibImages + 2, [], [])
get_calib_data_observ_points (CalibDataID, 0, 0, NumCalibImages + 2, Row1, Column1, Index1, CameraPosePos20)
* Clear the model
clear_calib_data (CalibDataID)
*
* Compute the coordinates of the origin of the calibration计算在世界坐标系下标定板在两个位置下的坐标
* table in the two positions with respect to the world
* coordinate system and determine the coordinates of the确定其对应的平移向量
* corresponding translation vector
set_origin_pose (CameraPosePos1, 0.0, 0.0, CalTabThickness, CameraPosePos1)
set_origin_pose (CameraPosePos20, 0.0, 0.0, CalTabThickness, CameraPosePos20)
*将一个三维姿态转换为一个齐次变换矩阵
pose_to_hom_mat3d (CameraPosePos1, HomMat3DPos1ToCamera)
pose_to_hom_mat3d (CameraPosePos20, HomMat3DPos20ToCamera)
*CameraPose表示世界坐标系到到相机坐标系的关系
pose_to_hom_mat3d (CameraPose, HomMat3DWorldToCamera)
*hom_mat3d_invert进行坐标系关系的转换,相机坐标系到世界坐标系的关系
hom_mat3d_invert (HomMat3DWorldToCamera, HomMat3DCameraToWorld)
*将两个齐次三维变换矩阵相乘,左矩阵,右矩阵,输出矩阵(两个时刻的标定板相对于世界坐标系的位置)
hom_mat3d_compose (HomMat3DCameraToWorld, HomMat3DPos1ToCamera, HomMat3DPos1ToWorld)
hom_mat3d_compose (HomMat3DCameraToWorld, HomMat3DPos20ToCamera, HomMat3DPos20ToWorld)
*进行仿射变换,求其运动的平移向量
affine_trans_point_3d (HomMat3DPos1ToWorld, 0, 0, 0, StartX, StartY, StartZ)
affine_trans_point_3d (HomMat3DPos20ToWorld, 0, 0, 0, EndX, EndY, EndZ)
MovementPoseNSteps := [EndX - StartX,EndY - StartY,EndZ - StartZ,0,0,0,0]
MovementPose := MovementPoseNSteps / StepNumber
String := [‘MovementPose: ‘,’ Tx = ’ + MovementPose[0] ′.3′+′m′,′Ty=′+MovementPose[1] ′ .3 ′ + ′ m ′ , ′ T y = ′ + M o v e m e n t P o s e [ 1 ] ’.3’ + ’ m’,’ Tz = ’ + MovementPose[2]$’.3’ + ’ m’,’ alpha = ’ + MovementPose[3] + ‘°’,’ beta = ’ + MovementPose[4] + ‘°’,’ gamma = ’ + MovementPose[5] + ‘°’,’ type = ’ + MovementPose[6]]
disp_message (WindowHandle, String, ‘window’, 12, 12, ‘black’, ‘true’)
disp_continue_message (WindowHandle, ‘black’, ‘true’)
stop ()
dev_clear_window ()
*
* ——-
* Part 4: Apply the calibration transforms to an already
* acquired disparity image.
* ——-应用
*
* Read an already acquired disparity map from file,差异图像
read_image (Disparity, ‘sheet_of_light/connection_rod_disparity.tif’)
* Create a model and set the required parameters
gen_rectangle1 (ProfileRegion, 120, 75, 195, 710)
create_sheet_of_light_model (ProfileRegion, [‘min_gray’,’num_profiles’,’ambiguity_solving’], [70,290,’first’], SheetOfLightModelID)
set_sheet_of_light_param (SheetOfLightModelID, ‘calibration’, ‘xyz’)
set_sheet_of_light_param (SheetOfLightModelID, ‘scale’, ‘mm’)
set_sheet_of_light_param (SheetOfLightModelID, ‘camera_parameter’, CameraParameters)
set_sheet_of_light_param (SheetOfLightModelID, ‘camera_pose’, CameraPose)
set_sheet_of_light_param (SheetOfLightModelID, ‘lightplane_pose’, LightPlanePose)
set_sheet_of_light_param (SheetOfLightModelID, ‘movement_pose’, MovementPose)
*
* Apply the calibration transforms and get the resulting calibrated coordinates
apply_sheet_of_light_calibration (Disparity, SheetOfLightModelID)
get_sheet_of_light_result (X, SheetOfLightModelID, ‘x’)
get_sheet_of_light_result (Y, SheetOfLightModelID, ‘y’)
get_sheet_of_light_result (Z, SheetOfLightModelID, ‘z’)
clear_sheet_of_light_model (SheetOfLightModelID)
*
* Display the resulting Z-coordinates
dev_close_window ()
get_image_size (Disparity, Width, Height)
dev_open_window (Height + 10, 0, Width * .5, Height * .5, ‘black’, WindowHandle3)
set_display_font (WindowHandle3, 14, ‘mono’, ‘true’, ‘false’)
dev_set_lut (‘temperature’)
dev_display (Z)
disp_message (WindowHandle3, ‘Calibrated Z-coordinates’, ‘window’, 12, 12, ‘black’, ‘true’)
*
* Display the resulting Y-coordinates
dev_open_window ((Height + 10) * .5, 0, Width * .5, Height * .5, ‘black’, WindowHandle2)
set_display_font (WindowHandle2, 14, ‘mono’, ‘true’, ‘false’)
dev_display (Y)
disp_message (WindowHandle2, ‘Calibrated Y-coordinates’, ‘window’, 12, 12, ‘black’, ‘true’)
*
* Display the resulting X-coordinates
dev_open_window (0, 0, Width * .5, Height * .5, ‘black’, WindowHandle1)
dev_display (X)
set_display_font (WindowHandle1, 14, ‘mono’, ‘true’, ‘false’)
disp_message (WindowHandle1, ‘Calibrated X-coordinates’, ‘window’, 12, 12, ‘black’, ‘true’)