title: Affine transformation in matlab
body: <p>My question is, if I need to perform an affine transformation that involve multiplying (rotation, scaling, shearing in y axis, shearing in x axis and translation) to achieve the following formula:</p>
  
  <p><img src="https://i.stack.imgur.com/wjWU8.png" alt="Affine transformation"></p>
  
  <p>Does the following code is a right implementation of the above formula?</p>
  
  <pre><code>rotation=[cos(theta) sin(theta) 0; -sin(theta) cos(theta) 0; 0 0 1];
  scaling=[lamdax 0 0; 0 lamda2 0; 0 0 1];
  shearingY=[1 0 0; alphay 1 0; 0 0 1];
  shearingX=[1 alphax 0; 0 1 0; 0 0 1];
  translation=[1 0 0; 0 1 0; dx dy 1];
  T=rotation*scaling*shearingY*shearingX*translation;
  T = maketform('affine',T);
  I2_hat=imtransform(I2,T);
  </code></pre>
  
  <p>Thank you very much in advance</p>