Get 2d Affine transformation from 2 pair of points

I have matrix with 4 points in homogeneous coordinates x1(x1; y1; z1).. x4(x4; y4; z4). I know that after applying Affine transformation to this matrix x1 moved to x1_prime, x2 - to x2_prime. How can I find the transformation matrix?
I tried
X = [x1 x2];
X_prime = [x1_prime x2_prime];
T = X_prime/X;
==
x1 = [1; 0; 1];
x2 = [0; 1; 1];
x1_prime = [2; 0; 1];
x2_prime = [-1; 1; 1];
X = [x1 x2];
X_prime = [x1_prime x2_prime ];
T = X_prime/X;
T contains zeroes in second column. Does not look like affine transform at all.. After I apply T on my 4 points I get segment.
Could you please help me to find Affine transformation matrix in Matlab? May be I should use fitgeotrans()?
Thanks

Categories

Find more on Programming in Help Center and File Exchange

Asked:

on 13 Apr 2014

Answered:

on 25 Jun 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!