Class AffineTransformBuilder


  • public class AffineTransformBuilder
    extends ProjectiveTransformBuilder
    Builds MathTransform setup as Affine transformation from a list of MappedPosition. The calculation uses least square method. The Affine transform equation:
      [ x']   [  m00  m01  m02  ] [ x ]   [ m00x + m01y + m02 ]
      [ y'] = [  m10  m11  m12  ] [ y ] = [ m10x + m11y + m12 ]
      [ 1 ]   [   0    0    1   ] [ 1 ]   [         1         ]
       x' = m * x 
    In the case that we have more identical points we can write it like this (in Matrix):
      [ x'1 ]      [ x1 y1 1  0  0  0 ]   [ m00 ]
      [ x'2 ]      [ x2 y2 1  0  0  0 ]   [ m01 ]
      [  .  ]      [        .         ]   [ m02 ]
      [  .  ]      [        .         ] * [ m10 ]
      [ x'n ]   =  [ xn yn 1  0  0  0 ]   [ m11 ]
      [ y'1 ]      [ 0  0  0  x1 y1 1 ]   [ m12 ]
      [ y'2 ]      [ 0  0  0  x2 y2 1 ]
      [  .  ]      [        .         ]
      [  .  ]      [        .         ]
      [ y'n ]      [ 0  0  0  xn yn 1 ]
      x' = A*m 
    Using the least square method we get this result:
    m = (ATA)-1 ATx'
    Since:
    2.4
    Author:
    Jan Jezek