Herror ::sim_caltab (
    Hobject *SimImage,
    const HTuple &CalTabDescrFile,
    const HTuple &CamParam,
    const HTuple &CamPose,
    const HTuple &GrayBackground,
    const HTuple &GrayCaltab,
    const HTuple &GrayMarks,
    const HTuple &ScaleFac
)
HImage HImage::SimCaltab (
    const HTuple &CalTabDescrFile,
    const HTuple &CamParam,
    const HTuple &CamPose,
    const HTuple &GrayBackground,
    const HTuple &GrayCaltab,
    const HTuple &GrayMarks,
    const HTuple &ScaleFac
)

Simulate a video image with calibration table.

::sim_caltab is used to generate a simulated calibration image. The calibration table description is read from the file CalTabDescrFile and will be projected into the image plane using the given camera parameters (internal camera parameters CamParam and external camera parameters CamPose), see also ::project_3d_point.

In the simulated image only the calibration table is shown. The image background is set to the gray value GrayBackground, the calibration table background is set to GrayCaltab, and the calibration marks are set to the gray value GrayMarks. The parameter ScaleFac influences the number of supporting points to approximate the elliptic contours of the calibration marks, see also ::disp_caltab. Increasing the number of supporting points causes a more accurate determination of the mark boundary, but increases the computation time, too. For each pixel of the simulated video image, which touches a subpixel-boundary of this kind, the gray value is set linearly between GrayMarks and GrayCaltab dependent on the proportion Inside/Outside.

By applying the operator ::sim_caltab you can generate synthetic calibration images (with known camera parameters!) to test the quality of the calibration algorithm (see ::camera_calibration).


Parameters

SimImage (output_object)
image -> Hobject * : HImage ( byte )
Simulated calibration image.

CalTabDescrFile (input_control)
string -> HTuple.char *
File name of the calibration table description.
Default value: 'caltab.descr'

CamParam (input_control)
number-array -> HTuple.double / long
Internal camera parameters.
Number of elements: 8

CamPose (input_control)
pose-array -> HTuple.double / long
External camera parameters.
Number of elements: 7

GrayBackground (input_control)
integer -> HTuple.long
Gray value of image background.
Default value: 128
Suggested values: 0, 32, 64, 96, 128, 160
Restriction: (0 <= GrayBackground) <= 255

GrayCaltab (input_control)
integer -> HTuple.long
Gray value of calibration table.
Default value: 224
Suggested values: 144, 160, 176, 192, 208, 224, 240
Restriction: (0 <= GrayCaltab) <= 255

GrayMarks (input_control)
integer -> HTuple.long
Gray value of calibration marks.
Default value: 80
Suggested values: 16, 32, 48, 64, 80, 96, 112
Restriction: (0 <= GrayMarks) <= 255

ScaleFac (input_control)
real -> HTuple.double
Scaling factor to reduce oversampling.
Default value: 1.0
Suggested values: 1.0, 0.5, 0.25, 0.125
Recommended increment: 0.05
Restriction: 1.0 >= ScaleFac


Example
HTuple StartCamPar,NX,NY,NZ;
HTuple RCoord1,CCoord1,StartPose1;
HTuple StartPose,RCoords,CCoords;
HTuple CamParam,FinalPose,Errors;
// read calibration image
HImage Image1("calib-01.tiff");
// find calibration pattern
HRegion Caltab1 = Image1.FindCaltab("caltab.descr",3,112,5);
// find calibration marks and initial pose
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,&StartPose);
// read 3D positions of calibration marks
::caltab_points("caltab.descr",&NX,&NY,&NZ);
// camera calibration
::camera_calibration(NX,NY,NZ,RCoord1,CCoord1,StartCamPar,StartPose,
                     11,&CamParam,&FinalPose,&Errors);
HImage Image1Sim = HImage::SimCaltab("caltab.descr",CamParam,FinalPose,
                                     128,224,80,1.0);

Result

::sim_caltab returns H_MSG_TRUE if all parameter values are correct. If necessary, an exception handling is raised.


Possible Predecessors

::camera_calibration, ::find_marks_and_pose, ::read_pose, ::read_cam_par, ::hom_mat3d_to_pose


Possible Successors

::find_caltab


See also

::find_caltab, ::find_marks_and_pose, ::camera_calibration, ::disp_caltab, ::create_pose, ::hom_mat3d_to_pose, ::project_3d_point, ::create_caltab


Module

Camera calibration



Copyright © 1996-2002 MVTec Software GmbH