Losing resolution after transformation using imwarp
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Matt J
2023-1-5
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 个评论
Matt J
2023-1-5
编辑:Matt J
2023-1-5
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]
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Feature Detection and Extraction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!