Operators |
read_cam_par — Read the internal camera parameters from a text file.
read_cam_par( : : CamParFile : CameraParam)
read_cam_par is used to read the internal camera parameters CameraParam from a text file with name CamParFile. The default HALCON file extension for the camera parameters is 'dat'. CameraParam is a tuple that contains the internal camera parameters in the following sequence (see calibrate_cameras or camera_calibration for a description of the corresponding 3D camera models):
For area scan cameras with the distortions modeled by the division model: [Focus, Kappa, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight]
For area scan cameras with the distortions modeled by the polynomial model: [Focus, Poly1, Poly2, Poly3, Poly4, Poly5, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight]
For line scan cameras: [Focus, Kappa, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight, Vx, Vy, Vz]
The format of the text file 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) ;
Comments are marked by a '#' at the beginning of a line.
read_cam_par expects in the file CamParFile one of the two following parameter groups.
The parameter group Camera:Parameter consists of the 8 internal camera parameters of the area scan camera for which the distortions are modeled by the division model (Focus, Kappa , Sx, Sy, Cx, Cy, ImageWidth and ImageHeight) or of the 12 internal camera parameters of the area scan camera for which the distortions are modeled by the polynomial model (Focus, Poly1, Poly2, Poly3, Poly4, Poly5, Sx, Sy, Cx, Cy, ImageWidth and ImageHeight).
A suitable file for the area scan camera for which the distortions are modeled by the division model can look like the following:
# INTERNAL CAMERA PARAMETERS ParGroup: Camera: Parameter; "Internal camera parameters"; Focus:foc: 0.00806039; DOUBLE:0.0:; "Focal length of the lens [meter]"; Kappa:kappa: -2253.5; DOUBLE::; "Radial distortion coefficient [1/(meter*meter)]"; Sx:sx: 1.0629e-05; DOUBLE:0.0:; "Width of a cell on the sensor [meter]"; Sy:sy: 1.1e-05; DOUBLE:0.0:; "Height of a cell on the sensor [meter]"; Cx:cx: 378.236; DOUBLE:0.0:; "X-coordinate of the image center [pixel]"; Cy:cy: 297.587; DOUBLE:0.0:; "Y-coordinate of the image center [pixel]"; ImageWidth:imgw: 768; INT:1:32767; "Width of the images [pixel]"; ImageHeight:imgh: 576; INT:1:32767; "Height of the images [pixel]";
A suitable file for the area scan camera for which the distortions are modeled by the polynomial model can look like the following:
# INTERNAL CAMERA PARAMETERS ParGroup: Camera: Parameter; "Internal camera parameters"; Focus:foc: 0.025; DOUBLE:0.0:; "Focal length of the lens [meter]"; Poly1:poly1: 0; DOUBLE::; "1st polynomial distortion coefficient"; Poly2:poly2: 0; DOUBLE::; "2nd polynomial distortion coefficient"; Poly3:poly3: 0; DOUBLE::; "3rd polynomial distortion coefficient"; Poly4:poly4: 0; DOUBLE::; "4th polynomial distortion coefficient"; Poly5:poly5: 0; DOUBLE::; "5th polynomial distortion coefficient"; Sx:sx: 1.1e-005; DOUBLE:0.0:; "Width of a cell on the sensor"; Sy:sy: 1.1e-005; DOUBLE:0.0:; "Height of a cell on the sensor"; Cx:cx: 384; DOUBLE::; "X-coordinate of the image center"; Cy:cy: 288; DOUBLE::; "Y-coordinate of the image center"; ImageWidth:imgw: 768; INT:1:32768; "Width of the images"; ImageHeight:imgh: 576; INT:1:32768; "Height of the images";
In addition to the 8 parameters of the parameter group Camera:Parameter with the divisional distortion model, the parameter group LinescanCamera:Parameter contains 3 parameters that describe the motion of the camera with respect to the object. With this, the parameter group LinescanCamera:Parameter consists of the 11 parameters Focus, Kappa , Sx, Sy, Cx, Cy, ImageWidth, ImageHeight, Vx, Vy und Vz. A suitable file can look like the following:
# INTERNAL CAMERA PARAMETERS ParGroup: LinescanCamera: Parameter; "Internal camera parameters"; Focus:foc: 0.061; DOUBLE:0.0:; "Focal length of the lens [meter]"; Kappa:kappa: -16.9761; DOUBLE::; "Radial distortion coefficient [1/(meter*meter)]"; Sx:sx: 1.06903e-05; DOUBLE:0.0:; "Width of a cell on the sensor [meter]"; Sy:sy: 1e-05; DOUBLE:0.0:; "Height of a cell on the sensor [meter]"; Cx:cx: 930.625; DOUBLE:0.0:; "X-coordinate of the image center [pixel]"; Cy:cy: 149.962; DOUBLE:0.0:; "Y-coordinate of the image center [pixel]"; ImageWidth:imgw: 2048; INT:1:32767; "Width of the images [pixel]"; ImageHeight:imgh: 3840; INT:1:32767; "Height of the images [pixel]"; Vx:vx: 1.41376e-06; DOUBLE::; "X-component of the motion vector [meter/scanline]"; Vy:vy: 5.45756e-05; DOUBLE::; "Y-component of the motion vector [meter/scanline]"; Vz:vz: 3.45872e-06; DOUBLE::; "Z-component of the motion vector [meter/scanline]";
File name of internal camera parameters.
Default value: 'campar.dat'
List of values: 'campar.dat' , 'campar.final' , 'campar.initial'
File extension: .dat
Internal camera parameters.
Number of elements: CameraParam == 8 || CameraParam == 11 || CameraParam == 12
* get internal camera parameters: read_cam_par('campar.dat', CameraParam)
read_cam_par returns 2 (H_MSG_TRUE) if all parameter values are correct and the file has been read successfully. If necessary an exception is raised.
find_marks_and_pose, sim_caltab, gen_caltab, disp_caltab, camera_calibration
find_caltab, find_marks_and_pose, camera_calibration, disp_caltab, sim_caltab, write_cam_par, write_pose, read_pose, project_3d_point, get_line_of_sight
Foundation
Operators |