Clear Filters
Clear Filters

Remove Distortion from an Image Using the Camera Parameters Object

1 view (last 30 days)
%The following numbers are the parameter after export from camera calibration.
Standard Errors of Estimated Camera Parameters
---------------------------------------------
Intrinsics
----------
%Focal length (pixels): [ 3882.2250 +/- 14.6398 3869.1827 +/- 14.6405 ]
%Principal point (pixels):[ 1943.6227 +/- 2.8872 1562.0646 +/- 3.4771 ]
%Radial distortion: [ -0.2094 +/- 0.0025 0.0879 +/- 0.0125 0.1341 +/- 0.0253 ]
%Tangential distortion: [ -0.0004 +/- 0.0001 -0.0001 +/- 0.0001 ]
I am using the following code to undistort my image, but I not sure what number should I enter based on my parameter numbers above. This is the link ( https://www.mathworks.com/help/vision/ug/remove-distortion-from-an-image-using-the-cameraparameters-object.html ) below.
IntrinsicMatrix = [715.2699 0 0; 0 711.5281 0; 565.6995 355.3466 1];
radialDistortion = [-0.3361 0.0921];
cameraParams = cameraParameters('IntrinsicMatrix',IntrinsicMatrix,'RadialDistortion',radialDistortion);
% Remove distortion from the images.
I = imread(fullfile(matlabroot,'toolbox','vision','visiondata','calibration','mono','image01.jpg'));
J = undistortImage(I,cameraParams);
% Display the original and the undistorted images.
figure; imshowpair(imresize(I,0.5),imresize(J,0.5),'montage');
title('Original Image (left) vs. Corrected Image (right)');

Answers (1)

Image Analyst
Image Analyst on 27 May 2022
If the distortion varies by all those amounts (the ranges you listed) then I don't know how to tell how much any one particular image was distorted - what it's specific parameters were. You might just have to do trial and error to see what works well. Hopefully whatever you find will work decently on all the other images.
  3 Comments
Image Analyst
Image Analyst on 27 May 2022
Put numbers inside the brackets. Sorry I have never used that function so I'd have to consult the documentation just like you'll have to do. Good luck.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!