Borrar filtros
Borrar filtros

construct and apply affine transformation matrix

3 visualizaciones (últimos 30 días)
Fatma Elzahraa Ahmed
Fatma Elzahraa Ahmed el 14 de Sept. de 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

Respuestas (0)

Categorías

Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by