用100mm标定文件进行标定,标定完成后,实际测量7.1cm,相机测量结果为7.5cm,误差0.4cm,求原因。。。以下为标定步骤,求大神指点
标定程序:
- * Image Acquisition 01: Code generated by Image Acquisition 01
- open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', '[1] RGB24 (2048x1536)', '[1]', 0, -1, AcqHandle)
- grab_image_start (AcqHandle, -1)
- grab_image_async (Image, AcqHandle, -1)
- * Calibration 01: Code generated by Calibration 01
- read_cam_par ('G:/halcon/halcon例程/标定测量/图片及参数(新)/12-27-02/参数.cal', CameraParameters)
- read_pose ('G:/halcon/halcon例程/标定测量/图片及参数(新)/12-27-02/位姿.dat', CameraPose)
- stop ()
- * Calibration 01: Sample code generated by Calibration 01
- * Calibration 01: For demonstration purposes, we use the calibration
- * Calibration 01: plate itself as sample object.
- * Calibration 01: Therefore, please take another calibration plate image
- stop ()
- grab_image_async (Image, AcqHandle, -1)
- close_framegrabber (AcqHandle)
- * Calibration 01: Extract plate data from the image
- TmpCtrl_PlateDescription := 'G:/halcon/halcon例程/制作标定板/caltab.descr'
- TmpCtrl_FindCalObjParNames := ['gap_tolerance','alpha','skip_find_caltab']
- TmpCtrl_FindCalObjParValues := [1,1,'false']
- * Calibration 01: Create calibration model for managing calibration data
- create_calib_data ('calibration_object', 1, 1, CalibHandle)
- set_calib_data_cam_param (CalibHandle, 0, [], CameraParameters)
- set_calib_data_calib_object (CalibHandle, 0, TmpCtrl_PlateDescription)
- find_calib_object (Image, CalibHandle, 0, 0, 0, TmpCtrl_FindCalObjParNames, TmpCtrl_FindCalObjParValues)
- get_calib_data_observ_points (CalibHandle, 0, 0, 0, TmpCtrl_MarkRows, TmpCtrl_MarkColumns, TmpCtrl_Ind, CameraPose)
- * Calibration 01: Using the calibration plate as test object, the marks actually
- * Calibration 01: lie above the corrected measurement plane. Therefore, we 'uncorrect'
- * Calibration 01: the plane of measurement by the plate thickness here.
- set_origin_pose (CameraPose, 0.0, 0.0, 0.001, CameraPose)
- * Calibration 01: **********************************************************
- * Calibration 01: Sample Task: Transform measurements into world coordinates
- * Calibration 01: **********************************************************
- * Calibration 01: First, obtain the image coordinates of some points of interest
- * Calibration 01: lying in the reference plane. Here, we simply take the first
- * Calibration 01: two mark center points of the plate
- TmpCtrl_ImageRows := [TmpCtrl_MarkRows[0], TmpCtrl_MarkRows[6]]
- TmpCtrl_ImageColumns := [TmpCtrl_MarkColumns[0], TmpCtrl_MarkColumns[6]]
- * Calibration 01: A line between the two points, just for visualization
- gen_contour_polygon_xld (TmpObj_ImageContour, TmpCtrl_ImageRows, TmpCtrl_ImageColumns)
- * Calibration 01: Convert image coordinate to world coordinates (using [mm])
- * Calibration 01: The Z coordinates will be 0 by definition (on reference plane)
- image_points_to_world_plane (CameraParameters, CameraPose, TmpCtrl_ImageRows, TmpCtrl_ImageColumns, 'mm', TmpCtrl_WorldX, TmpCtrl_WorldY)
- * Calibration 01: Determine the distance in world coordinate [mm]
- distance_pp (TmpCtrl_WorldY[0], TmpCtrl_WorldX[0], TmpCtrl_WorldY[1], TmpCtrl_WorldX[1], TmpCtrl_Distance)
- stop ()
复制代码
|