Camera Intrinsics for camera 2 not returned by estimateCa​meraParame​ters.

15 views (last 30 days)
Hi, can anyone explain the following?
After running the below commands:
[imagePoints,pairsUsed] = detectCircleGridPoints(CameraOneImages.Files,CameraTwoImages.Files,[9 11],PatternType="asymmetric",circleColor="white");
centerDistance = 2.2;
worldPoints = generateCircleGridPoints([9 11], centerDistance);
imageSize=[1701 1651];
params = estimateCameraParameters(imagePoints,worldPoints, 'ImageSize',imageSize);
When I check for the intrinsic matrix for camera 2, I found that "Camera Intrinsic" for camera 2 is not returned by the function estimateCameraParameters. What could be the cause for not reporting the "Camera Intrinsic" for camera 2? Everything appears to be okay since the function detectCircleGridPoints detects the centers of all the white dots in all the images and did not report any warnings and errors.
  2 Comments
Matt J
Matt J on 27 Oct 2022
We cannot run your code unless you provide imagePoints,pairsUsed in a .mat file.
hlseck
hlseck on 27 Oct 2022
Hi Matt, I have provided the imagePoints and pairsUsed in the attached .mat file.
Thanks in advance.

Sign in to comment.

Answers (2)

Giridharan Kumaravelu
Giridharan Kumaravelu on 31 Oct 2022
It looks like the estimateCameraParameters function did not have sufficient number of quality points to converge to a better solution. Because of that it did not go far away from its initial estimates for the camera parameters (which can be negative too).
Looking at the plots generated by @Matt J, it appears that the calibration images lack variety in poses and also there were only 6 images.
@hlseck Please increase the number of calibration images and also calibrate with sufficient variety as described in this doc page: https://www.mathworks.com/help/vision/ug/prepare-camera-and-capture-images.html#mw_abbcc91e-07ab-4e40-a3b6-bb4a263e8379.

Matt J
Matt J on 27 Oct 2022
Edited: Matt J on 27 Oct 2022
Hmmm. It seems like it might be a version-related problem. When I run your code in R2022a, I get intrinsics for both cameras:
>> params.CameraParameters1.Intrinsics
ans =
cameraIntrinsics with properties:
FocalLength: [5.8522e+05 3.4051e+05]
PrincipalPoint: [3.0379e+03 1.4885e+03]
ImageSize: [1701 1651]
RadialDistortion: [-2.0671 -2.6121e+05]
TangentialDistortion: [0 0]
Skew: 0
IntrinsicMatrix: [3×3 double]
>> params.CameraParameters2.Intrinsics
ans =
cameraIntrinsics with properties:
FocalLength: [5.6750e+05 3.0497e+05]
PrincipalPoint: [786.3843 1.0454e+03]
ImageSize: [1701 1651]
RadialDistortion: [-72.1295 1.0642]
TangentialDistortion: [0 0]
Skew: 0
IntrinsicMatrix: [3×3 double]
However, running it here in the forum (which is R2022b), generates significantly different intrinsics for camera1 and errors for camera2:
load('imagePoints_pairsUsed.mat')
centerDistance = 2.2;
worldPoints = generateCircleGridPoints([9 11], centerDistance);
imageSize=[1701 1651];
params = estimateCameraParameters(imagePoints,worldPoints, 'ImageSize',imageSize);
params.CameraParameters1.Intrinsics
ans =
cameraIntrinsics with properties: FocalLength: [5.9768e+05 3.4533e+05] PrincipalPoint: [2.0518e+03 1.1783e+03] ImageSize: [1701 1651] RadialDistortion: [-16.0594 -4.4515e+05] TangentialDistortion: [0 0] Skew: 0 K: [3×3 double]
params.CameraParameters2.Intrinsics
Error using vision.internal.cameraIntrinsicsImpl>parseInputsSimulation
The value of 'principalPoint' is invalid. Expected principalPoint to be positive.

Error in vision.internal.cameraIntrinsicsImpl>parseInputs (line 191)
r = parseInputsSimulation(defaultParams,varargin{:});

Error in vision.internal.cameraIntrinsicsImpl (line 82)
r = parseInputs(varargin{:});

Error in cameraIntrinsics (line 67)
this = this@vision.internal.cameraIntrinsicsImpl(varargin{:});

Error in vision.internal.calibration.CameraParametersImpl/get.Intrinsics (line 502)
intrinsics = cameraIntrinsics(this.FocalLength, ...
  3 Comments
hlseck
hlseck on 27 Oct 2022
Yes, the distance between camera centers is smaller than the distance from the camera to the calibration target. The ratio of their distances is about 0.3. Is there a way to constrain the focal length so as to get a more reliable calibration.
Matt J
Matt J on 27 Oct 2022
Edited: Matt J on 27 Oct 2022
0.3 doesn't seem too bad ...
No, I don't believe there is a way to constrain the parameter estimates. However, you might try varying the position of the calibration pattern a bit more among your 6 images. Currently, they all seem to give points in approximately the same positions.

Sign in to comment.

Categories

Find more on MATLAB Support Package for USB Webcams in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!