Finding an affine transformation matrix

In summary, the conversation discusses a problem in computer vision where an affine transformation matrix, A, is needed to transform a unit square into a given quadrilateral. Methods using homogeneous coordinates are suggested, but it is noted that the transformation may not exist if the quadrilateral is not a parallelogram. A counterexample is provided to illustrate this, and it is concluded that an affine transformation must preserve the ratio of lengths of line segments, which can be used to determine the fourth corner of the quadrilateral.
  • #1
chroot
Staff Emeritus
Science Advisor
Gold Member
10,295
41
Hey guys,

I have a problem in a computer vision application that requires me to find an affine transformation matrix, A.

What I've got are four corners of a quadrilateral, in 2D coordinates on the image plane. These are the projections of the 3D corners of the real quadrilateral onto the image plane.

What I need to find is the 3D affine transformation matrix, A, which transforms the corners of a unit square into the given corners. If I can easily determine if such a transform does not exist, that information would also be useful.

Methods using homogeneous coordinates are fine, of course.

Anyone have any ideas?

- Warren
 
Physics news on Phys.org
  • #2
if the corners of the image are A,B,C,D, let's translate back to the origin, by subtracting A from all of them.

Then A-A is at the origin, and we have three more points,oops. wait a minute, is this quadrilateral a parallelogram?

if not it seems hard to map a square onto it by an affine map. i.e. an affine map is just a translate of a linear map, and it seems a linear map must send a square to a parallelogram, no?

anyway, back to work: if we take two of the three translated corners say B-A, and C-A, we can make a matrix with those as columns.

then that matrix will send the unit square to the parallelogram spanned by 0 = A-A, B-A, and C-A. then translating back by A, will send the unit square to the parallelogram spanned by A,B,C.

but it might not send the 4th corner of the square to D, unless D-A = B-A + C-A, as vectors.

does this seem right?
 
  • #3
here is a counterexample:
img530.imageshack.us/img530/2964/notaffinert8.png
 
  • #4
maze said:
here is a counterexample:
img530.imageshack.us/img530/2964/notaffinert8.png
Affine transformations map lines to lines; yours isn't affine.
 
  • #5
mathwonk said:
does this seem right?
Looks right to me; I got the same result (only works if the image is a parallelogram) in a different manner. Given two line segments lying on the same line, affine transformations preserve the ratio of their lengths. In particular, the diagonals of a square bisect each other -- and so that must also be true of its image, meaning it has to be a parallelogram.

In general, given the following information about a quadrilateral ABCD whose diagonals intersect at E:

. A
. B
. C
. AE / EC
. BE / ED

the point D is uniquely determined.
 
  • #6
Hurkyl said:
Affine transformations map lines to lines; yours isn't affine.

thats why its a counterexample...
 

1. What is an affine transformation matrix?

An affine transformation matrix is a mathematical representation of a transformation that preserves the shape of an object while allowing for translation, rotation, scaling, and shearing. It is commonly used in computer graphics, computer vision, and other fields of science and engineering.

2. How is an affine transformation matrix calculated?

An affine transformation matrix is calculated using a set of known points in both the original and transformed coordinates. The matrix is formed by solving a system of linear equations using the known points as data. This can be done manually or using software such as MATLAB.

3. What are some applications of affine transformation matrices?

Affine transformation matrices have a wide range of applications in various fields such as computer graphics, computer vision, robotics, and image processing. They are commonly used to manipulate images, map one coordinate system to another, and perform geometric transformations in 2D and 3D space.

4. How do affine transformation matrices differ from other types of transformation matrices?

Affine transformation matrices differ from other types of transformation matrices, such as perspective transformation matrices, in that they do not alter the shape of an object. Perspective transformation matrices also account for depth and can produce foreshortening effects, while affine transformation matrices only deal with 2D transformations.

5. Are there any limitations to using affine transformation matrices?

While affine transformation matrices are useful for many applications, they do have some limitations. They can only represent linear transformations, so they cannot accurately represent non-linear distortions. Additionally, they may not be suitable for highly complex or detailed transformations, as the resulting matrix may not be easily solvable.

Similar threads

  • Linear and Abstract Algebra
Replies
2
Views
2K
  • Linear and Abstract Algebra
Replies
5
Views
2K
  • Linear and Abstract Algebra
Replies
2
Views
3K
  • Linear and Abstract Algebra
Replies
17
Views
4K
  • Linear and Abstract Algebra
Replies
4
Views
2K
  • Linear and Abstract Algebra
Replies
3
Views
1K
  • Linear and Abstract Algebra
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Linear and Abstract Algebra
Replies
4
Views
5K
  • Linear and Abstract Algebra
Replies
5
Views
2K
Back
Top