Write the internal camera parameters to text file.
write_cam_par is used to write the internal camera parameters CamParam to a text file with name CamParFile.
The format of the text file is a (HORUS-independent) generic parameter description. Thus, arbitrary sets of parameters can be grouped together in a hierarchical way. 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) ;The following parameter types are supported in this generic format: BOOL, XBOOL (exclusive BOOL), INT, FLOAT, DOUBLE, STRING und FILE_SELECTOR. Comments are marked by a '' at the beginning of a line.
The operator write_cam_par writes the parameter group Camera:Parameter into the text file CamParFile. This parameter group consists of the 8 parameters Focus, Sx, Sy, Cx, Cy, Kappa , ImageWidth and ImageHeight.
The underlying camera model is a pinhole camera with radial distortions. It describes the transform of a 3D world point P_W into a (sub-)pixel [r,c] of the video image by the following equations:
P_C = (x,y,z) = R*P_W + T u = Focus * x / z v = Focus * y / z u' = (2*u) / (1+sqrt(1-4*Kappa*(u^2+v^2))) v' = (2*v) / (1+sqrt(1-4*Kappa*(u^2+v^2))) c = u' / Sx + Cx r = v' / Sy + CyThese equations consist of a coordinate transform from the world coordinate system into the camera coordinate system, a perspective projection into the image plane, a radial distortion of the projected point, and finally a sampling and a image center displacement.
The parameter R and T describe the 3D pose of the camera coordinate system in the world coordinate system. They are called external camera parameters, see also hom_mat_to_pose and write_cam_pose.
The internal camera parameters consist of the focal length (Focus), the radial distortion coefficient (Kappa), the scale factor Sx and Sy (horizontal and vertical distance between cells on the CCD chip), the image center (Cx,Cy), and the used image width and height. The internal camera parameters are - in contrast to the external parameters - independent on the actual pose of the CCD camera. They describe the projection process of the used combination of camera, lens, and framegrabber. The determination of these parameters is done by the camera calibration, see camera_calibration.
CamParam (input_control) |
number-array -> real / integer |
Internal camera parameters. | |
Number of elements: 8 |
CamParFile (input_control) |
string -> string |
File name of internal camera parameters. | |
Default value: 'campar.dat' | |
List of values: 'campar.dat', 'campar.initial', 'campar.final' |
/* read calibration images */ read_image(:Image1:'calib-01.tiff':) > read_image(:Image2:'calib-02.tiff':) > read_image(:Image3:'calib-03.tiff':) > /* find calibration pattern */ find_caltab(Image1:Caltab1:'caltab.descr',3,112:) > find_caltab(Image2:Caltab2:'caltab.descr',3,112:) > find_caltab(Image3:Caltab3:'caltab.descr',3,112:) > /* find calibration marks and start poses */ find_marks_and_pose(Image1,Caltab1::'caltab.descr',[0.008,0.0, 0.000011,0.000011,384,288,768,576],128,10:RCoord1,CCoord1,StartPose1) > find_marks_and_pose(Image2,Caltab2::'caltab.descr',[0.008,0.0, 0.000011,0.000011,384,288,768,576],128,10:RCoord2,CCoord2,StartPose2) > find_marks_and_pose(Image3,Caltab3::'caltab.descr',[0.008,0.0, 0.000011,0.000011,384,288,768,576],128,10:RCoord3,CCoord3,StartPose3) > /* read 3D positions of calibration marks */ caltab_points(::'caltab.descr':NX,NY,NZ) > /* camera calibration */ camera_calibration(::NX,NY,NZ,[RCoord1,RCoord2,RCoord3], [CCoord1,CCoord2,CCoord3],[0.008,0.0,0.000011,0.000011,384,288,768,576], [StartPose1,StartPose2,StartPose3],11:CamParam,NFinalPose,Errors) > /* write internal camera parameters to file*/ write_cam_par(::CamParam,'campar.dat':).
write_cam_par returns 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_cam_pose, read_cam_pose, project_3d_point, inverse_project_pixel