construct and apply affine transformation matrix

4 ビュー (過去 30 日間)
Fatma Elzahraa Ahmed
Fatma Elzahraa Ahmed 2015 年 9 月 14 日
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

回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric 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