Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finding an affine transformation matrix

  1. May 19, 2008 #1

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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
     
  2. jcsd
  3. May 19, 2008 #2

    mathwonk

    User Avatar
    Science Advisor
    Homework Helper
    2015 Award

    if the corners of the image are A,B,C,D, lets 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?
     
  4. May 19, 2008 #3
    here is a counterexample:
    img530.imageshack.us/img530/2964/notaffinert8.png
     
  5. May 19, 2008 #4

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Affine transformations map lines to lines; yours isn't affine.
     
  6. May 19, 2008 #5

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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.
     
  7. May 19, 2008 #6
    thats why its a counterexample...
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Finding an affine transformation matrix
  1. Matrix Transformation (Replies: 8)

  2. Matrix Transform (Replies: 8)

Loading...