Extract transformation matrix from image distortion

16 Ansichten (letzte 30 Tage)
windmill
windmill am 4 Nov. 2020
Beantwortet: Steve Eddins am 4 Nov. 2020
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');

Akzeptierte Antwort

Steve Eddins
Steve Eddins am 4 Nov. 2020
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.

Weitere Antworten (0)

Kategorien

Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by