How to use undistorImage with multiple images?

3 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Image Analyst
Image Analyst il 15 Nov 2020
Modificato: Image Analyst il 15 Nov 2020
See the FAQ:
In the middle of the loop, call a function that processes just the current image.
  2 Commenti
mikel lasa
mikel lasa il 18 Nov 2020
I tried this and it WORKS! thank you for the help!
Image Analyst
Image Analyst il 18 Nov 2020
Are you then ready to "Accept this answer"? Thanks in advance.

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by