So, if I have an image that is rotated, scaled, skewed, how could I get the matrix decomposed?
If my matrix contains all the possible transformation, have I to decompose the matrix (obtaining some intermediate matrix subtracting something) or could I find my values (rotating degrees, scaling factor, etc….) in another manner?
Below there is written “if the image is rotated” and then I find the scaling value. What could I do with it?
First of all, if you just need to know the resolution of an image, which is independent of the transformation imposed on it, you can simply use Element::GetImageWidth() and Element::GetImageHeight(). These two functions give you the number of pixels of the image in the canonical space.
When rasterized, an image is first mapped to page space (by CTM that is determined by the PDF content, which you can get by calling Element::GetCTM()) and then mapped to client space (by a user matrix U, e.g., determined by the zoom value). So, you can be talking about CTM, or U*CTM. Either way, given an affine transformation matrix M, it can be decomposed as M = t * r * sc * sh, where t is a translation matrix, r is a rotation matrix, sc is a scaling matrix and sh is a shear matrix. Note that this decomposition is not necessarily unique. You can find lots of information online (e.g., http://callumhay.blogspot.ca/2010/10/decomposing-affine-transforms.html) We will expose the decomposition method in Matrix2D class we use internally in the next release.