How to use undistorImage with multiple images?

3 次查看(过去 30 天)
Hello,
After getting my camera calibration parameters, I want to undistort all my 13 images using undistortImage function. My issue comes when I try undistort all the images in one function, is any way to do that?
You can see in my code that "imageFileNames" is a 13x1 array. Can I obtain somehow another 13x1 array with the undistorted images?
my code so far:
%%
clc; close all;clear all;
%% calibracion
% Create a set of calibration images.
%images = imageDatastore(fullfile(toolboxdir('vision'), 'visiondata','calibration', 'cal_1'));
images = imageDatastore(fullfile('C:\MASTER\VISION_ARTIFICIAL\computer_vision\ejercicio_calibracion\fotos_movil'));
imageFileNames = images.Files;
% DETECTA EL PATRON DE CALIBRACION, devuelve los puntos en el patron y el
% tamañano en celdal patron, en este caso es de 12 por 13
[imagePoints, boardSize] = detectCheckerboardPoints(imageFileNames);
% leer la primera imagen para conseguir el tamaño de la imagen
I = readimage(images,1);
imageSize = [size(I, 1), size(I, 2)];
% genera las coordenadas en el patron, 0,0 corresponde a la parte inferior
% izquierda del patron
squareSize = 15; % millimeters
worldPoints = generateCheckerboardPoints(boardSize, squareSize);
[params, imagesUsed, estimationErrors] = estimateCameraParameters(imagePoints, worldPoints,'ImageSize', imageSize,'EstimateSkew',true);
showReprojectionErrors(params);
figure;
showExtrinsics(params);
%% Rectificado de las imagenes
% remover distorsiones de cada imagen
J=undistortImage(imageFileNames(all,1),params);
figure;
imshowpair(I,J(1),'montage');
Thanks in davance and regards!

采纳的回答

Image Analyst
Image Analyst 2020-11-15
编辑:Image Analyst 2020-11-15
See the FAQ:
In the middle of the loop, call a function that processes just the current image.

更多回答(0 个)

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by