Operators |
write_cam_par — Write the internal camera parameters to a text file.
write_cam_par( : : CameraParam, CamParFile : )
write_cam_par is used to write the internal camera parameters CameraParam to a text file with name CamParFile.
The default HALCON file extension for the camera parameters is 'dat'.
The number of values in CameraParam depends on the specified CameraType. See the description of set_calib_data_cam_param for a list of values and calibrate_cameras for details on camera types and camera parameters.
The internal camera parameters describe the projection process of the used combination of camera, lens, and frame grabber; they can be determined calibrating the camera using calibrate_cameras or camera_calibration.
The format of the text file CamParFile is a (HALCON-independent) generic parameter description. It allows to group arbitrary sets of parameters hierarchically. The description of a single parameter within a parameter group consists of the following 3 lines:
Name : Shortname : Actual value ; Type : Lower bound (optional) : Upper bound (optional) ; Description (optional) ;
Depending on the number of elements of CameraParam, the parameter groups Camera:Parameter or LinescanCamera:Parameter, respectively, are written into the text file CamParFile (see read_cam_par for an example). The parameter group Camera:Parameter consists of the 8 to 14 internal camera parameters of the area scan camera models. The parameter group LinescanCamera:Parameter consists of the 11 internal camera parameters of the line scan camera.
Internal camera parameters.
Number of elements: CameraParam == 8 || CameraParam == 10 || CameraParam == 11 || CameraParam == 12 || CameraParam == 14
File name of internal camera parameters.
Default value: 'campar.dat'
List of values: 'campar.dat' , 'campar.final' , 'campar.initial'
File extension: .dat
* * Calibrate the camera. * StartCamPar := [0.016,0,0.0000074,0.0000074,326,247,652,494] create_calib_data ('calibration_object', 1, 1, CalibDataID) set_calib_data_cam_param (CalibDataID, 0, 'area_scan_division', StartCamPar) set_calib_data_calib_object (CalibDataID, 0, 'caltab_30mm.descr') NumImages := 10 for I := 1 to NumImages by 1 read_image (Image, ImgPath + 'calib_' + I$'02d') find_calib_object (Image, CalibDataID, 0, 0, I, [], []) get_calib_data_observ_contours (Caltab, CalibDataID, 'caltab', 0, 0, I) endfor calibrate_cameras (CalibDataID, Error) get_calib_data (CalibDataID, 'camera', 0, 'params', CamParam) * Write the internal camera parameters to a file write_cam_par (CamParam, 'camera_parameters.dat')
write_cam_par returns 2 (H_MSG_TRUE) if all parameter values are correct and the file has been written successfully. If necessary an exception is raised.
find_caltab, find_marks_and_pose, camera_calibration, disp_caltab, sim_caltab, read_cam_par, write_pose, read_pose, project_3d_point, get_line_of_sight
Foundation
Operators |