필터 지우기
필터 지우기

construct and apply affine transformation matrix

조회 수: 3 (최근 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 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