Losing resolution after transformation using imwarp
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1253097/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1253102/image.jpeg)
0 Kommentare
Akzeptierte Antwort
Matt J
am 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 Kommentare
Matt J
am 5 Jan. 2023
Bearbeitet: Matt J
am 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]
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Display Image finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!