Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

As a simpler form, the Affine Transform is a special case of the Perspective Transform, with the bottom row as [0,0,1].

If you look here you can see how it decomposes into scale, rotation, and translation. The analogy of scale isn't quite perfect with a Perspective Transform, since different parts of the image have different scale factors, but as an approximation, just pretend it's an affine matrix and decompose it. This will fail if there is a large non-planar component.

Or you could go the stupid simple route and take the distance between each of the four points, and each of the others, calculate the 6 scale factors, and average them. If you're trying to find the size of image you need to warp into, taking the four corners of the original image, putting all four through the perspective transform, and finding the bounding box will do it.

It rather depends on what you want to do with it.