camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration performs the calibration of a single camera.
For this, known 3D model points (with coordinates NXNXNXNXNX,
NYNYNYNYNY, NZNZNZNZNZ) are projected into the image and the sum
of the squared distances between the projected 3D-coordinates and
their corresponding image point coordinates (NRowNRowNRowNRowNRow,
NColNColNColNColNCol) is minimized.
For a successful calibration, at least one calibration object with
accurately known metric properties is needed, e.g., a HALCON
calibration plate. Before calling camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration, take a
series of images of the calibration object in different orientations
and make sure that the whole field of view or measurement volume is
covered. The success of the calibration highly depends on the
quality of the calibration object and the images. So you might want
to exercise special diligence during the acquisition of the
calibration images. See the section “How to take a set of suitable
images?” in Calibration / Multi-View for further details.
The input parameter EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams is used to select which
camera parameters to estimate. Usually, this parameter is set to
'all'"all""all""all""all", i.e., all 6 external camera parameters (translation
and rotation) and all internal camera parameters are determined. If
the internal camera parameters already have been determined (e.g.,
by a previous call to camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration), it is often
desired to only determine the pose of the world coordinate system in
camera coordinates (i.e., the external camera parameters). In this
case, EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams can be set to 'pose'"pose""pose""pose""pose". This
has the same effect as EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams =
['alpha','beta','gamma','transx','transy','transz']["alpha","beta","gamma","transx","transy","transz"]["alpha","beta","gamma","transx","transy","transz"]["alpha","beta","gamma","transx","transy","transz"]["alpha","beta","gamma","transx","transy","transz"].
Otherwise, EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams contains a tuple of strings that
indicates the combination of parameters to estimate. In addition,
parameters can be excluded from estimation by using the prefix
~. For example, the values
['pose','~transx']["pose","~transx"]["pose","~transx"]["pose","~transx"]["pose","~transx"]
have the same effect as
['alpha','beta','gamma','transy','transz']["alpha","beta","gamma","transy","transz"]["alpha","beta","gamma","transy","transz"]["alpha","beta","gamma","transy","transz"]["alpha","beta","gamma","transy","transz"]. As a different
example,
['all','~focus']["all","~focus"]["all","~focus"]["all","~focus"]["all","~focus"]
determines all internal and external parameters except the
focus. The prefix ~ can be used with all parameter
values except 'all'.
Which limitations exist for the determination of the
camera parameters?
For additional informations about general limitations when
determining camera parameters, please see the section
“Further Limitations Related to Specific Camera Types” in the chapter
Calibration / Multi-View.
What is the order within the individual parameters?
The length of the tuple NStartPoseNStartPoseNStartPoseNStartPoseNStartPose depends on the number of
calibration images, e.g., using 15 images leads to a length of the
tuple NStartPoseNStartPoseNStartPoseNStartPoseNStartPose equal to
(15 times the 7 external camera parameters). The first 7 values
correspond to the pose of the calibration plate in the first image,
the next 7 values to the pose in the second image, etc.
This fixed number of calibration images must be considered within
the tuples with the coordinates of the 3D model marks and the
extracted 2D marks. If 15 images are used, the length of the tuples
NRowNRowNRowNRowNRow and NColNColNColNColNCol is 15 times the length of the tuples
with the coordinates of the 3D model marks (NXNXNXNXNX,
NYNYNYNYNY, and NZNZNZNZNZ). If every image consists 49 marks,
the length of the tuples NRowNRowNRowNRowNRow and NColNColNColNColNCol is
, while the length of the tuples
NXNXNXNXNX, NYNYNYNYNY, and NZNZNZNZNZ is 49. The order of the
values in NRowNRowNRowNRowNRow and NColNColNColNColNCol is “image after image”,
i.e., using 49 marks the first 3D model point corresponds to the
1st, 50th, 99th, 148th, 197th, 246th, etc. extracted 2D mark.
As an additional parameter, the root mean square error (RMSE)
(ErrorsErrorsErrorsErrorserrors) of the back projection of the optimization is
returned. This parameter reflects the accuracy of the calibration.
The error value (root mean square error of the position) is measured
in pixels. If only a single camera is calibrated, an Error in the
order of 0.1 pixel (the typical detection error by extraction of the
coordinates of the projected calibration markers) is an indication
that the optimization fits the observation data well. If
ErrorsErrorsErrorsErrorserrors strongly differs from 0.1 pixels, the calibration
did not perform well. Reasons for this might be, e.g., a poor image
quality, an insufficient number of calibration images, or an
inaccurate calibration plate.
Do I have to use a planar calibration object?
No. The operator camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration is designed in a way
that the input tuples NXNXNXNXNX, NYNYNYNYNY, NZNZNZNZNZ,
NRowNRowNRowNRowNRow, and NColNColNColNColNCol can contain any 3D/2D
correspondences. The order of the single parameters is explained in
the paragraph “What is the order within the individual
parameters?”.
Thus, it makes no difference how the required 3D model marks and the
corresponding 2D marks are determined. On the one hand, it is
possible to use a 3D calibration object, on the other hand, you also
can use any characteristic points (e.g. natural landmarks) with
known position in the world. By setting EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams to
'pose'"pose""pose""pose""pose", it is thus possible to compute the pose of an
object in camera coordinates! For this, at least three
3D/2D-correspondences are necessary as input. NStartPoseNStartPoseNStartPoseNStartPoseNStartPose
can, e.g., be generated directly as shown in the program example for
create_posecreate_poseCreatePoseCreatePoseCreatePose.
For line scan cameras, it is possible to set the start value for the
internal camera parameter Sy to the value 0.0. In this case, it is
not possible to determine the position of the principal point in
y-direction. Therefore, EstimateParamsEstimateParamsEstimateParamsEstimateParamsestimateParams must contain the
term '~cy'"~cy""~cy""~cy""~cy". The effective
distance of the principle point from the sensor line is then always
. Further
information can be found in the section “Further Limitations Related
to Specific Camera Types” of Calibration / Multi-View.
Execution Information
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration returns 2 (H_MSG_TRUE) if all parameter values are
correct and the desired camera parameters have been determined by
the minimization algorithm. If necessary, an exception is raised.