Effacer les filtres
Effacer les filtres

Imwarp results in unwanted image resize

2 vues (au cours des 30 derniers jours)
Nikolay Vinnichenko
Nikolay Vinnichenko le 15 Juin 2018
I'm trying to correct for keystone distortion for a flat object imaged by the camera with incidence angle about 15-20 degrees. So, I shot several checkerboard images and obtained camera parameters with estimateCameraParameters function. Then I determine the transformation from one of the checkerboard images, invert it and use imwarp to obtain the image as if it was taken orthogonally to the object. And I'm very surprised to see that, whereas the original image im is 3456x5184x3, the transformed image imNew is only 186x317x3. Is it possible to keep the original image resolution? Here is the code, MyCamParams.mat contains camera parameters cameraParams determined by calibration.
load('MyCamParams');
[workimname, workimpath]=uigetfile('*.jpg');
im=imread(fullfile(workimpath, workimname));
[imagePoints, boardSize]=detectCheckerboardPoints(im);
squareSize=10; % in millimeters
worldPoints=generateCheckerboardPoints(boardSize, squareSize);
[R, t]=extrinsics(imagePoints, worldPoints, cameraParams);
T=[R(1, :); R(2, :); t]*cameraParams.IntrinsicMatrix;
tform=projective2d(T);
imNew=imwarp(im, invert(tform));

Réponses (0)

Produits


Version

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by