Name
write_cam_parT_write_cam_parWriteCamParwrite_cam_parWriteCamParWriteCamPar — Write the internal camera parameters to a text file.
write_cam_parwrite_cam_parWriteCamParwrite_cam_parWriteCamParWriteCamPar is used to write the internal camera parameters
CameraParamCameraParamCameraParamCameraParamCameraParamcameraParam to a text file with name CamParFileCamParFileCamParFileCamParFileCamParFilecamParFile. The
default HALCON file extension for the camera parameters is 'dat'.
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_camerascalibrate_camerasCalibrateCamerascalibrate_camerasCalibrateCamerasCalibrateCameras or
camera_calibrationcamera_calibrationCameraCalibrationcamera_calibrationCameraCalibrationCameraCalibration. The descriptions of these operators contain also
detailed information about the available 3D camera models.
CameraParamCameraParamCameraParamCameraParamCameraParamcameraParam is a tuple that contains the
internal camera parameters in the following sequences:
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 CamParFileCamParFileCamParFileCamParFileCamParFilecamParFile 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 CameraParamCameraParamCameraParamCameraParamCameraParamcameraParam, the parameter
groups Camera:Parameter or LinescanCamera:Parameter, respectively, are
written into the text file CamParFileCamParFileCamParFileCamParFileCamParFilecamParFile (see read_cam_parread_cam_parReadCamParread_cam_parReadCamParReadCamPar
for an example).
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 or of the 12 internal camera parameters of the area scan
camera for which the distortions are modeled by the polynomial model. The
parameter group LinescanCamera:Parameter consists of the 11 internal camera
parameters of the line scan camera.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Internal camera parameters.
Number of elements: CameraParam == 8 || CameraParam == 11 || CameraParam == 12
File name of internal camera parameters.
Default value:
'campar.dat'
"campar.dat"
"campar.dat"
"campar.dat"
"campar.dat"
"campar.dat"
List of values: 'campar.dat'"campar.dat""campar.dat""campar.dat""campar.dat""campar.dat", 'campar.final'"campar.final""campar.final""campar.final""campar.final""campar.final", 'campar.initial'"campar.initial""campar.initial""campar.initial""campar.initial""campar.initial"
File extension: .dat
* read calibration images
read_image(Image1, 'calib-01')
read_image(Image2, 'calib-02')
read_image(Image3, 'calib-03')
* find calibration pattern
find_caltab(Image1, Caltab1, 'caltab.descr', 3, 112, 5)
find_caltab(Image2, Caltab2, 'caltab.descr', 3, 112, 5)
find_caltab(Image3, Caltab3, 'caltab.descr', 3, 112, 5)
* find calibration marks and start poses
StartCamPar := [Focus, Kappa, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight]
find_marks_and_pose(Image1, Caltab1, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, RCoord1, CCoord1, \
StartPose1)
find_marks_and_pose(Image2, Caltab2, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, RCoord2, CCoord2, \
StartPose2)
find_marks_and_pose(Image3, Caltab3, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, 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], StartCamPar, \
[StartPose1, StartPose2, StartPose3], 'all', \
CameraParam, NFinalPose, Errors)
* write internal camera parameters to file
write_cam_par(CameraParam, 'campar.dat')
* read calibration images
read_image(Image1, 'calib-01')
read_image(Image2, 'calib-02')
read_image(Image3, 'calib-03')
* find calibration pattern
find_caltab(Image1, Caltab1, 'caltab.descr', 3, 112, 5)
find_caltab(Image2, Caltab2, 'caltab.descr', 3, 112, 5)
find_caltab(Image3, Caltab3, 'caltab.descr', 3, 112, 5)
* find calibration marks and start poses
StartCamPar := [Focus, Kappa, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight]
find_marks_and_pose(Image1, Caltab1, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, RCoord1, CCoord1, \
StartPose1)
find_marks_and_pose(Image2, Caltab2, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, RCoord2, CCoord2, \
StartPose2)
find_marks_and_pose(Image3, Caltab3, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, 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], StartCamPar, \
[StartPose1, StartPose2, StartPose3], 'all', \
CameraParam, NFinalPose, Errors)
* write internal camera parameters to file
write_cam_par(CameraParam, 'campar.dat')
* read calibration images
read_image(Image1, 'calib-01')
read_image(Image2, 'calib-02')
read_image(Image3, 'calib-03')
* find calibration pattern
find_caltab(Image1, Caltab1, 'caltab.descr', 3, 112, 5)
find_caltab(Image2, Caltab2, 'caltab.descr', 3, 112, 5)
find_caltab(Image3, Caltab3, 'caltab.descr', 3, 112, 5)
* find calibration marks and start poses
StartCamPar := [Focus, Kappa, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight]
find_marks_and_pose(Image1, Caltab1, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, RCoord1, CCoord1, \
StartPose1)
find_marks_and_pose(Image2, Caltab2, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, RCoord2, CCoord2, \
StartPose2)
find_marks_and_pose(Image3, Caltab3, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, 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], StartCamPar, \
[StartPose1, StartPose2, StartPose3], 'all', \
CameraParam, NFinalPose, Errors)
* write internal camera parameters to file
write_cam_par(CameraParam, 'campar.dat')
HTuple StartCamPar, NX, NY, NZ;
HTuple RCoord1, CCoord1, StartPose1;
HTuple RCoord2, CCoord2, StartPose2;
HTuple RCoord3, CCoord3, StartPose3;
HTuple StartPoses, RCoords, CCoords;
HTuple CameraParam, NFinalPose, Errors;
// read calibration images
HImage Image1("calib-01");
HImage Image2("calib-02");
HImage Image3("calib-03");
// find calibration pattern
HRegion Caltab1 = Image1.FindCaltab("caltab.descr", 3, 112, 5);
HRegion Caltab2 = Image2.FindCaltab("caltab.descr", 3, 112, 5);
HRegion Caltab3 = Image3.FindCaltab("caltab.descr", 3, 112, 5);
// find calibration marks and start poses
StartCamPar[7] = 576; // ImageHeight
StartCamPar[6] = 768; // ImageWidth
StartCamPar[5] = 288; // Cy
StartCamPar[4] = 384; // Cx
StartCamPar[3] = 0.000011; // Sy
StartCamPar[2] = 0.000011; // Sx
StartCamPar[1] = 0.0; // Kappa
StartCamPar[0] = 0.008; // Focus
RCoord1 = Image1.FindMarksAndPose(Caltab1, "caltab.descr",StartCamPar,
128,10, &CCoord1, &StartPose1);
RCoord2 = Image2.FindMarksAndPose(Caltab2, "caltab.descr", StartCamPar,
128,10, &CCoord2, &StartPose2);
RCoord3 = Image3.FindMarksAndPose(Caltab3, "caltab.descr", StartCamPar,
128,10, &CCoord3, &StartPose3);
// read 3D positions of calibration marks
caltab_points("caltab.descr", &NX, &NY, &NZ);
// camera calibration
StartPoses = (StartPose1.Append(StartPose2)).Append(StartPose3);
RCoords = (RCoord1.Append(RCoord2)).Append(RCoord3);
CCoords = (CCoord1.Append(CCoord2)).Append(CCoord3);
camera_calibration(NX, NY, NZ, RCoords, CCoords, StartCamPar, StartPoses,
11, &CameraParam, &NFinalPose, &Errors);
// write internal camera parameters to file
write_cam_par(CameraParam, "campar.dat");
* read calibration images
read_image(Image1, 'calib-01')
read_image(Image2, 'calib-02')
read_image(Image3, 'calib-03')
* find calibration pattern
find_caltab(Image1, Caltab1, 'caltab.descr', 3, 112, 5)
find_caltab(Image2, Caltab2, 'caltab.descr', 3, 112, 5)
find_caltab(Image3, Caltab3, 'caltab.descr', 3, 112, 5)
* find calibration marks and start poses
StartCamPar := [Focus, Kappa, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight]
find_marks_and_pose(Image1, Caltab1, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, RCoord1, CCoord1, \
StartPose1)
find_marks_and_pose(Image2, Caltab2, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, RCoord2, CCoord2, \
StartPose2)
find_marks_and_pose(Image3, Caltab3, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, 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], StartCamPar, \
[StartPose1, StartPose2, StartPose3], 'all', \
CameraParam, NFinalPose, Errors)
* write internal camera parameters to file
write_cam_par(CameraParam, 'campar.dat')
* read calibration images
read_image(Image1, 'calib-01')
read_image(Image2, 'calib-02')
read_image(Image3, 'calib-03')
* find calibration pattern
find_caltab(Image1, Caltab1, 'caltab.descr', 3, 112, 5)
find_caltab(Image2, Caltab2, 'caltab.descr', 3, 112, 5)
find_caltab(Image3, Caltab3, 'caltab.descr', 3, 112, 5)
* find calibration marks and start poses
StartCamPar := [Focus, Kappa, Sx, Sy, Cx, Cy, ImageWidth, ImageHeight]
find_marks_and_pose(Image1, Caltab1, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, RCoord1, CCoord1, \
StartPose1)
find_marks_and_pose(Image2, Caltab2, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, RCoord2, CCoord2, \
StartPose2)
find_marks_and_pose(Image3, Caltab3, 'caltab.descr', StartCamPar, \
128, 10, 18, 0.9, 15.0, 100.0, 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], StartCamPar, \
[StartPose1, StartPose2, StartPose3], 'all', \
CameraParam, NFinalPose, Errors)
* write internal camera parameters to file
write_cam_par(CameraParam, 'campar.dat')
write_cam_parwrite_cam_parWriteCamParwrite_cam_parWriteCamParWriteCamPar returns 2 (H_MSG_TRUE) if all parameter values are
correct and the file has been written successfully. If necessary an
exception is raised.
camera_calibrationcamera_calibrationCameraCalibrationcamera_calibrationCameraCalibrationCameraCalibration
find_caltabfind_caltabFindCaltabfind_caltabFindCaltabFindCaltab,
find_marks_and_posefind_marks_and_poseFindMarksAndPosefind_marks_and_poseFindMarksAndPoseFindMarksAndPose,
camera_calibrationcamera_calibrationCameraCalibrationcamera_calibrationCameraCalibrationCameraCalibration,
disp_caltabdisp_caltabDispCaltabdisp_caltabDispCaltabDispCaltab,
sim_caltabsim_caltabSimCaltabsim_caltabSimCaltabSimCaltab,
read_cam_parread_cam_parReadCamParread_cam_parReadCamParReadCamPar,
write_posewrite_poseWritePosewrite_poseWritePoseWritePose,
read_poseread_poseReadPoseread_poseReadPoseReadPose,
project_3d_pointproject_3d_pointProject3dPointproject_3d_pointProject3dPointProject3dPoint,
get_line_of_sightget_line_of_sightGetLineOfSightget_line_of_sightGetLineOfSightGetLineOfSight
Foundation