Losing resolution after transformation using imwarp
    10 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
I'm working on a camera calibration through a series of pictures of a checkerboard. The original size of the images are 2048x2448. After transformation, the resulting corrected image with 'imwarp' is only 310x367. Although the transformation seems correct, the resolution seems very low to me and I'm wondering why the resolution dropped so significantly. The transformation I performing is some minor intrinsic/extrinsic corrections. 
Here is the code used. The variable 'cameraParams' is obtained after successfully using the "camera calibration tool" from the "Computer Vision Toolbox v10.2". Both the raw image (.bmp) and the 'cameraParams.mat' are attached.
Thanks for the help.
[im_a, newOrigin] = undistortImage(imread(strcat(figlocation,fig_name)), cameraParams);
imagePoints = squeeze(cameraParams.ReprojectedPoints(:,:,end));
tf = fitgeotrans(imagePoints,cameraParams.WorldPoints,'projective');
[xf1,xf1_ref] = imwarp(im_a,tf,'cubic');
im_b=rot90(xf1);
figure;imshow(im_a);title('image')
figure;imshow(im_b);title('transformed image')


0 commentaires
Réponse acceptée
  Matt J
      
      
 le 5 Jan 2023
        load cameraParams
im0=imread('b8-12212022142637-2006.Bmp');
[im_a, newOrigin] = undistortImage(im0, cameraParams);
imagePoints = squeeze(cameraParams.ReprojectedPoints(:,:,end));
tf = fitgeotrans(imagePoints,cameraParams.WorldPoints,'projective');
[~,xf1_ref] = imwarp(im_a,tf,'cubic');
xf1_ref.ImageSize=flip(size(im_a));
[xf1,xf1_ref] = imwarp(im_a,tf,'cubic','OutputView',xf1_ref);
im_b=rot90(xf1);
figure;imshow(im_a);title('image')
figure;imshow(im_b);title('transformed image')
2 commentaires
  Matt J
      
      
 le 5 Jan 2023
				
      Modifié(e) : Matt J
      
      
 le 5 Jan 2023
  
			imtool() is assuming the pixel sizes are 1 mm. I'm not aware if there is a way to tell it that the actual pixel sizes are about 0.15 mm,
xf1_ref = 
  imref2d with properties:
           XWorldLimits: [-76.6815 233.3185]
           YWorldLimits: [-105.2473 261.7527]
              ImageSize: [2448 2048]
    PixelExtentInWorldX: 0.1514
    PixelExtentInWorldY: 0.1499
    ImageExtentInWorldX: 310
    ImageExtentInWorldY: 367
       XIntrinsicLimits: [0.5000 2.0485e+03]
       YIntrinsicLimits: [0.5000 2.4485e+03]
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Image Processing and Computer Vision dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




