Extract transformation matrix from image distortion

3 次查看(过去 30 天)
Hey, I have used the following code for image distortion using control points. I would like to extract the transformation matrix that has been applied to the distorted image using the imwarp function. Is there any way to extract the transformation matrix so I can apply the same transformation also to other images?
clc
clear all
close all
orthophoto = imread('cropped_image.tif');
figure, imshow(orthophoto)
unregistered = imread('cropped_image2.tif');
figure, imshow(unregistered)
[movingPoints, fixedPoints] = cpselect(unregistered,orthophoto,'Wait',true);
movingPoints
fixedPoints
pause
t = fitgeotrans(movingPoints, fixedPoints,'polynomial', 2);
Rfixed = imref2d(size(orthophoto));
registered = imwarp(unregistered,t,'OutputView',Rfixed);
imshow(registered)
imwrite(registered, 'undistorted_cropped_image2.tif');

采纳的回答

Steve Eddins
Steve Eddins 2020-11-4
In your call to fitgeotrans, you have specified that you want a 'polynomial' transformation. This type of transformation is not characterized by a matrix, at least not in the sense of an affine transform matrix. However, you can still use the output, t, in calls to imwarp to warp other images the same way.
In the call to fitgeotrans, if you specify a transform type that is characterized by a matrix, then you can retrieve the matrix using t.T.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometric Transformation and Image Registration 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by