필터 지우기
필터 지우기

How to use undistorImage with multiple images?

조회 수: 3 (최근 30일)
mikel lasa
mikel lasa 2020년 11월 15일
댓글: Image Analyst 2020년 11월 18일
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.
  댓글 수: 2
mikel lasa
mikel lasa 2020년 11월 18일
I tried this and it WORKS! thank you for the help!
Image Analyst
Image Analyst 2020년 11월 18일
Are you then ready to "Accept this answer"? Thanks in advance.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by