Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sixth value is for shear. Affine transformation (the most general transformation that can be expressed by 2x3 matrix) has rotation, shear, scale x/y, and translation x/y. See this for more details.

Now about your other question. Your assumption is not entirely correct. Rotation, translation, scale or shear are not stored in Transformation Matrix. Lets assume you have 2x3 transformation matrix A.

A = ( (a(0,0),a(0,1),a(0,2)), (a(1,0),a(1,1),a(1,2)) )

Now you want to apply A on point (x,y). Resulting point is this one:

x_new = a(0,0)*x + a(0,1)*y + a(0,2)
y_new = a(1,0)*x + a(1,1)*y + a(1,2)

As you can see none of values of A is actually rotation or scale.

Also it is important to remember that 2x3 matrix don't have to be affine. It can be some simpler transformation as well (rigid, scale, similarity, and so on). For example if a(0,0) = a(1,1) = 1 and a(0,1) = a(1,0) = 0, than your transformation is just translation.

Here I saw very good answer about how to calculate rotation, scale, and translation from transformation matrix. I don't remember how to extract shear, but if you don't have it this will be enough.