Herror ::find_marks_and_pose (
Hobject Image,
Hobject CalTabRegion,
const HTuple &CalTabDescrFile,
const HTuple &StartCamParam,
const HTuple &StartThresh,
const HTuple &DeltaThresh,
const HTuple &MinThresh,
const HTuple &Alpha,
const HTuple &MinContLength,
const HTuple &MaxDiamMarks,
HTuple *RCoord,
HTuple *CCoord,
HTuple *StartPose
)
HTuple HImage::FindMarksAndPose (
const HRegion &CalTabRegion,
const HTuple &CalTabDescrFile,
const HTuple &StartCamParam,
const HTuple &StartThresh,
const HTuple &DeltaThresh,
const HTuple &MinThresh,
const HTuple &Alpha,
const HTuple &MinContLength,
const HTuple &MaxDiamMarks,
HTuple *CCoord,
HTuple *StartPose
) const
Extract the 2D calibration marks from the video image and
calculate initial values for the external camera parameters.
::find_marks_and_pose is used to determine the necessary
input data for the subsequent camera calibration (see
::camera_calibration): On the one hand the 2D center points
[RCoord,CCoord] of the calibration marks within
the region CalTabRegion of the input image Image
are extracted and ordered. On the other hand a rough estimate for
the external camera parameters (StartPose) is computed,
i.e., the 3D pose of the camera in the calibration table coordinate
system.
In the input image Image an edge detector is applied
(see ::edges_image, mode 'lanser2') to the region
CalTabRegion,
which may have been found by applying the operator ::find_caltab.
The filter parameter for this edge detection can be tuned via
Alpha.
In the edge image closed contours are searched for: The number of
closed contours must correspond to the number of calibration marks
as described in the calibration table description file
CalTabDescrFile and the contours have to be ellipticly shaped.
Contours shorter than MinContLength are discarded,
just as contours enclosing regions with a diameter larger than
MaxDiamMarks (e.g., the border of the calibration table).
For the detection of contours a threshold operator is applied
to amplitude of the edge detector.
All points with a high amplitude (i.e. borders of marks)
are selected.
First, the threshold value is set to
StartThresh. If the search for the closed contours or the
successive pose estimate fails, this threshold value is successively
decreased by DeltaThresh down to a minimum value of
MinThresh.
Each of the found contours is refined with subpixel accuracy (see
::edges_sub_pix) and
subsequently approximated by an ellipse. The center points of these
ellipses represent a good approximation of the desired 2D image coordinates
[RCoord,CCoord] of the calibration mark center points.
The order of the values within these two tuples is in row-major order
beginning at the upper left in the image. This order must correspond to
the order of the 3D coordinates of the calibration marks in the calibration
table description file CalTabDescrFile, since this fixes the
correspondences between extracted image marks and known model marks!
Based on the ellipse parameters for each calibration mark a rough
estimate for the external camera parameters is computed finally.
For that purpose the fixed correspondences between extracted image marks
and known model marks are used. The estimate StartPose
describes the pose of the camera in the calibration table coordinate
system (see ::create_pose) as desired by the operator
::camera_calibration.
Parameters
Image (input_object)
|
image -> Hobject: HImage ( byte )
|
|
Input image. |
CalTabRegion (input_object)
|
region -> Hobject: HRegion
|
|
Region of the calibration table. |
CalTabDescrFile (input_control)
|
string -> HTuple.char *
|
|
File name of the calibration table description. |
|
Default value: 'caltab.descr' |
StartCamParam (input_control)
|
number-array -> HTuple.double / long
|
|
Initial values for the internal camera parameters. |
StartThresh (input_control)
|
number -> HTuple.long
|
|
Initial threshold value for contour detection. |
|
Default value: 128 |
|
List of values: 80, 96, 112, 128, 144, 160 |
DeltaThresh (input_control)
|
number -> HTuple.long
|
|
Loop value for successive reduction of
StartThresh. |
|
Default value: 10 |
|
List of values: 6, 8, 10, 12, 14, 16, 18, 20, 22 |
MinThresh (input_control)
|
number -> HTuple.long
|
|
Minimum threshold for contour detection. |
|
Default value: 18 |
|
List of values: 8, 10, 12, 14, 16, 18, 20, 22 |
Alpha (input_control)
|
real -> HTuple.double
|
|
Filter parameter for contour detection, see
::edges_image. |
|
Default value: 0.9 |
|
Suggested values: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1 |
|
Typical range of values: 0.2 <= Alpha <= 50.0 |
|
Minimum increment: 0.01
|
Recommended increment: 0.1
|
|
Restriction: Alpha > 0.0 |
MinContLength (input_control)
|
real -> HTuple.double
|
|
Minimum length of the contours of the marks. |
|
Default value: 15.0 |
|
Suggested values: 10.0, 15.0, 20.0, 30.0, 40.0, 100.0 |
|
Restriction: MinContLength > 0.0 |
MaxDiamMarks (input_control)
|
real -> HTuple.double
|
|
Maximum expected diameter of the marks. |
|
Default value: 100.0 |
|
Suggested values: 50.0, 100.0, 150.0, 200.0, 300.0 |
|
Restriction: MaxDiamMarks > 0.0 |
RCoord (output_control)
|
real-array -> HTuple.double *
|
|
Tuple with row-coordinates of the detected marks. |
CCoord (output_control)
|
real-array -> HTuple.double *
|
|
Tuple with column-coordinates of the detected marks. |
StartPose (output_control)
|
pose-array -> HTuple.double * / long *
|
|
Estimation for the external camera parameters. |
|
Number of elements: 7 |
Example
HTuple StartCamPar,RCoord,CCoord,StartPose;
// read calibration image
HImage Image("calib-01.tiff");
// find calibration pattern
HRegion Caltab = Image.FindCaltab("caltab.descr",3,112,5);
// read internal camera parameters from file
::read_cam_par("campar.dat",&StartCamPar);
// find calibration marks and start pose
RCoord = Image.FindMarksAndPose(Caltab,"caltab.descr",StartCamPar,
128,10,18,0.9,15.0,100.0,
&CCoord,&StartPose);
Result
::find_marks_and_pose returns H_MSG_TRUE if all parameter values are
correct and an estimation for the external camera parameters has been
determined successfully. If necessary, an exception handling is raised.
Possible Predecessors
::find_caltab
Possible Successors
::camera_calibration
See also
::find_caltab,
::camera_calibration,
::disp_caltab,
::sim_caltab,
::read_cam_par,
::read_pose,
::create_pose,
::pose_to_hom_mat3d,
::caltab_points,
::create_caltab,
::edges_sub_pix,
::edges_image
Module
Camera calibration
Copyright © 1996-2002 MVTec Software GmbH