Effacer les filtres
Effacer les filtres

construct and apply affine transformation matrix

3 vues (au cours des 30 derniers jours)
Fatma Elzahraa Ahmed
Fatma Elzahraa Ahmed le 14 Sep 2015
Hello, I am trying to construct affine transformation matrix through a parameter vactror of rotation angle, scaling, shearing and displacement values. The vector is organized as follow:
phai=[rotationAngle, scalingCoefX, scalingCoefY, shearingCoefX, shearingCoefY, translationCoefX, translationCoefY]';
To construct the affine transformation matrix I apply the following code:
rotation=[cos(phai(1)) sin(phai(1)) 0; -sin(phai(1))cos(phai(1)) 0; 0 0 1];
scaling=[phai(2) 0 0; 0 phai(3) 0; 0 0 1];
shearingY=[1 0 0; phai(5) 1 0; 0 0 1];
shearingX=[1 phai(4) 0; 0 1 0; 0 0 1];
translation=[1 0 0; 0 1 0; phai(6) phai(7) 1];
T=rotation*scaling*shearingY*shearingX*translation;
T = maketform('affine',T);
Then to apply the result to an image (c) I use the perform:
c=imtransform(c,T);
My question is: is this code right because it takes a lot of time to be executed? is there any suggestions to speed up the execution in the case that the code is right?
Thank you very much

Réponses (0)

Catégories

En savoir plus sur Geometric Transformation and Image Registration 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!

Translated by