Undistortion of the image giving an error

28 ビュー (過去 30 日間)
muhammad choudhry
muhammad choudhry 2020 年 9 月 28 日
コメント済み: Ashwani gulati 2021 年 10 月 6 日
Hi,
I am trying to remove the distortion from the images but I am getting an error. I am using GOPro Hero 7 camera. Thing is whenever I used the checkerboard images from the same camera and only used the checkerboard image to remove the distortion from one of them images it removes the distortion but whenever I used the actual experimental image to remove the distortion from it I am getting the error shown below
Error:
Error using vision.internal.inputValidation.checkImageSize (line 14)
Image size is not consistent with camera intrinsics. It is likely that the image is not generated by
the specified camera.
Error in undistortImage (line 94)
vision.internal.inputValidation.checkImageSize(I, intrinsics.ImageSize);
Error in calibration3 (line 46)
[im, newOrigin] = undistortImage(imOrig, cameraParams, 'OutputView', 'full');
Code used: (This is one of the matlab example code I used)
%Create a cell array of file names of calibration images.
numImages = 12;
files = cell(1, numImages);
for i = 1:numImages
files{i} = fullfile(matlabroot, 'toolbox', 'vision', 'visiondata', ...
'calibration', 'vfc', sprintf('image%d.jpg', i));
end
% Display one of the calibration images
I = imread(files{1});
%figure; imshow(I);
%title('One of the Calibration Images');
%Estimate Camera Parameters
% Detect the checkerboard corners in the images.
[imagePoints, boardSize] = detectCheckerboardPoints(files);
% Generate the world coordinates of the checkerboard corners in the
% pattern-centric coordinate system, with the upper-left corner at (0,0).
squareSize = 22; % in millimeters
worldPoints = generateCheckerboardPoints(boardSize, squareSize);
% Calibrate the camera.
imageSize = [size(I, 1), size(I, 2)];
cameraParams = estimateCameraParameters(imagePoints, worldPoints, ...
'ImageSize', imageSize);
% Evaluate calibration accuracy.
figure; showReprojectionErrors(cameraParams);
title('Reprojection Errors');
%Read the Image of Objects to Be Measured
imOrig = imread(fullfile(matlabroot, 'toolbox', 'vision', 'visiondata', ...
'calibration', 'vfc', 'image25.jpg'));
figure; imshow(imOrig);
title('Input Image');
%Undistort the Image
% Since the lens introduced little distortion, use 'full' output view to illustrate that
% the image was undistored. If we used the default 'same' option, it would be difficult
% to notice any difference when compared to the original image. Notice the small black borders.
[im, newOrigin] = undistortImage(imOrig, cameraParams, 'OutputView', 'full');
figure; imshow(im);
title('Undistorted Image');

採用された回答

Nitin Kapgate
Nitin Kapgate 2020 年 10 月 7 日
The size of image you are trying to undistort is different from the size of images used for estimating the camera calibration parameters. The camera parameters are being estimated from the inbuilt MATLAB calibration images.
In order to use the the undistortImage function to remove distortion from the images captured by your GoPro camera, you will need to estimate the camera intrinsics, extrinsics, and lens distortion parameters using the calibration images taken by your camera.
You can use thisworkflow to calibrate your camera using the Camera Calibrator App.
  1 件のコメント
Ashwani gulati
Ashwani gulati 2021 年 10 月 6 日
Hello,
I have used stereo camera calibrator but still it's giving my this error.
Error using vision.internal.inputValidation.checkImageSize (line 14)
Image size is not consistent with camera intrinsics. It is likely that the image is not generated by the specified camera.
Error in rectifyStereoImages (line 126)
vision.internal.inputValidation.checkImageSize(I1, stereoParams.CameraParameters1.ImageSize);
Error in Depthestimationfromstereovideolenovocameratest5 (line 54)
rectifyStereoImages(frameLeft, frameRight, stereoParams);
could you please help me with this?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCamera Calibration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by