Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Affine transformation algorithm

Tags:

algorithm

math

Does anyone know of any standard algorithms to determine an affine transformation matrix based upon a set of known points in two co-ordinate systems?

like image 763
Adam C. Avatar asked May 03 '10 01:05

Adam C.


People also ask

What is affine transformation example?

Examples of affine transformations include translation, scaling, homothety, similarity, reflection, rotation, shear mapping, and compositions of them in any combination and sequence.

How do you calculate affine transformation?

The affine transforms scale, rotate and shear are actually linear transforms and can be represented by a matrix multiplication of a point represented as a vector, [x y ] = [ax + by dx + ey ] = [a b d e ][x y ] , or x = Mx, where M is the matrix.

What do you mean by affine transformation?

Affine transformation is a linear mapping method that preserves points, straight lines, and planes. Sets of parallel lines remain parallel after an affine transformation. The affine transformation technique is typically used to correct for geometric distortions or deformations that occur with non-ideal camera angles.

What are the types of affine transformations?

Types of affine transformations include translation (moving a figure), scaling (increasing or decreasing the size of a figure), and rotation (turning a figure about a point).


1 Answers

Affine transformations are given by 2x3 matrices. We perform an affine transformation M by taking our 2D input (x y), bumping it up to a 3D vector (x y 1), and then multiplying (on the left) by M.

So if we have three points (x1 y1) (x2 y2) (x3 y3) mapping to (u1 v1) (u2 v2) (u3 v3) then we have

   [x1 x2 x3]   [u1 u2 u3] M  [y1 y2 y3] = [v1 v2 v3].    [ 1  1  1] 

You can get M simply by multiplying on the right by the inverse of

[x1 x2 x3] [y1 y2 y3] [ 1  1  1]. 

A 2x3 matrix multiplied on the right by a 3x3 matrix gives us the 2x3 we want. (You don't actually need the full inverse, but if matrix inverse is available it's easy to use.)

Easily adapted to other dimensions. If you have more than 3 points you may want a least squares best fit. You'll have to ask again for that, but it's a little harder.

like image 121
sigfpe Avatar answered Oct 06 '22 02:10

sigfpe