*外参标定即为相机坐标系和系统世界坐标系关系的旋转和平移矩阵;可以简化理解为一个3*3的矩阵
ImgPath := '3d_machine_vision/calib/'
dev_close_window ()
dev_open_window (0, 0, 652, 494, 'black', WindowHandle)
dev_update_off ()
dev_set_draw ('margin')
dev_set_line_width (1)
set_display_font (WindowHandle, 14, 'courier', 'true', 'false')
* Read the internal camera parameters from file
*读取刚刚得到的相机内参;ps:外参标定必须先标定好相机的内参
read_cam_par ('camera_parameters.dat', CamParam)
*
* Determine the external camera parameters and world coodinates from image points
*
*这个外参相机参数能通过图像来获得,如果这个标定板直接放置下测量平面上的话
* The external camera parameters can be determined from an image, where the
* calibration plate is positioned directly on the measurement plane
read_image (Image, ImgPath + 'calib_11')
dev_display (Image)
CaltabName := 'caltab_30mm.descr'
create_calib_data ('calibration_object', 1, 1, CalibDataID)
* Here, the final camera parameters are already known and can be used instead
* of the starting values used in the program 'camera_calibration_internal.hdev'
set_calib_data_cam_param (CalibDataID, 0, 'area_scan_division', CamParam)
set_calib_data_calib_object (CalibDataID, 0, CaltabName)
find_calib_object (Image, CalibDataID, 0, 0, 1, [], [])
get_calib_data_observ_contours (Caltab, CalibDataID, 'caltab', 0, 0, 1)
PoseForCalibrationPlate(这个表示这张图片中相机对应的相机外参为多少)
get_calib_data_observ_points (CalibDataID, 0, 0, 1, RCoord, CCoord, Index, PoseForCalibrationPlate)
dev_set_color ('green')
dev_display (Caltab)
dev_set_color ('red')
disp_caltab (WindowHandle, CaltabName, CamParam, PoseForCalibrationPlate, 1)
dev_set_line_width (3)