Note, however, that you cannot perform 3D measurements in world
coordinates with this operator because it does not calibrate the
focal length and the scaling factors.
The estimation of the distortions is based on the assumption that a
significant number of straight lines are visible in the imaged
scene. Because of lens distortions, these lines will
be projected to curved contours. The operator now determines suitable
parameters by which the curved contours can be straightened again, thus
compensating the lens distortions.
The operator automatically estimates those contours from
ContoursContoursContoursContoursContourscontours that are images of lines of the image scene using
the robust RANSAC method. The contours that do not fulfill this
condition and hence are not suited for the calibration process are
called outliers. The operator can cope with a maximum outlier
percentage of 50 percent. A contour is classified as an outlier if
the mean deviation of the contour from its associated straight line
is, after the distortion correction, higher than a given threshold
T.
With the parameter RandSeedRandSeedRandSeedRandSeedRandSeedrandSeed, you can control the randomized
behavior of the RANSAC algorithm and force it to return reproducible
results. The parameter is passed as initial value to the internally
used random number generator. If it is set to a positive value, the
operator returns identical results for each call with identical
parameter values.
The distortion parameters
or
, respectively, are estimated via the
methods 'variable'"variable""variable""variable""variable""variable", 'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive", or
'fixed'"fixed""fixed""fixed""fixed""fixed", which are specified via the parameter
DistortionCenterDistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenter. In the default mode 'variable'"variable""variable""variable""variable""variable",
the distortion center c is estimated with all the other calibration
parameters at the same time. Here, many contours should lie equally
distributed near the image borders or the distortion should be high.
Otherwise, the search for the distortion center could be ill-posed,
which results in instability. With the method 'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive",
the distortion center c is at first fixed in the image center.
Then, the outliers are eliminated by using the
InlierThresholdInlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThreshold. Finally, the calibration process is rerun
by estimating or
, respectively, which will be accepted if
results from a stable calibration
and lies near the image center. Otherwise, c will be
assumed to lie in the image center. This method should be used if
the distortion center can be assumed to lie near the image center
and if very few contours are available or the position of other
contours is bad (e.g., the contours have the same direction or lie
in the same image region). By choosing the method 'fixed'"fixed""fixed""fixed""fixed""fixed",
the distortion center will be assumed fixed in the image center and
only or
,
respectively, will be estimated. This method should be used in case of
very weak distortions or few contours in bad position.
List of values: 'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive", 'fixed'"fixed""fixed""fixed""fixed""fixed", 'variable'"variable""variable""variable""variable""variable"
Controls the deviation of the distortion center
from the image center; larger values allow
larger deviations from the image center; 0
switches the penalty term off.
* Assume that GrayImage is one image in gray values with a
* resolution of 640 x 480 and a suitable number of contours. Then
* the following example performs the calibration using these
* contours and corrects the image with the estimated distortion
* parameters.
edges_sub_pix (GrayImage, Edges, 'canny', 1.0, 20, 40)
segment_contours_xld (Edges, ContoursSplit, 'lines_circles', 5, 8, 4)
radial_distortion_self_calibration (ContoursSplit, SelectedContours, \
640, 480, 0.08, 42, 'division', \
'variable', 0, CameraParam)
get_domain (GrayImage, Domain)
change_radial_distortion_cam_par ('fullsize', CameraParam, 0, CamParamOut)
change_radial_distortion_image (GrayImage, Domain, ImageRectified, \
CameraParam, CamParamOut)
If the parameters are valid, the operator
radial_distortion_self_calibrationradial_distortion_self_calibrationRadialDistortionSelfCalibrationradial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibration returns the value 2 (H_MSG_TRUE).
If necessary an exception is raised.
T. Thormälen, H. Broszio: “Automatic line-based estimation of
radial lens distortion”; in: Integrated Computer-Aided
Engineering; vol. 12; pp. 177-190; 2005.