Académique Documents
Professionnel Documents
Culture Documents
EMPIRICAL TRANSFORMATIONS
GIANNI GORGOGLIONE
2= - my*sin(+)
b2= my*cos(+)
The 6 parameters of the transformation are estimated using common points. If for example
we have 3 common points in both systems (the minimum number of control points needed),
then we can have a linear system of 6 equations, using the values X,Y and x,y of our 3
common points. The equation system would be as following:
X1= a+a1*x1+ 2*y1
X2= a+a1*x2+ 2*y2
X3= a+a1*x3+ 2*y3
Y1=bo+b1*x1+b2*y1
Y2=bo+b1*x2+b2*y2
Y3=bo+b1*x3+b2*y3
The transformation parameters Xo, Yo, mx, my, , are computed from the parameters a, a1,
2, bo, b1, b2 using the following relationships:
Xo= a
Yo= bo
mx=SQRT(a12+b12)
my=SQRT((a22+b22)
GIANNI GORGOGLIONE
Task
The matlab files with the finction and the code are included in the .zip file
Affine function
function [Xo,Yo,alpha,beta,mx,my] = affine1(points);
%function affine1 that computes the 6 unknown parameters of affine
%transformation
% Detailed explanation goes here
points = load('gcp.txt');
X= points(:,2);
Y= points(:,3);
% Here we join the "1" elements and the x,y co-ordinates in one matrix.
xy= cat(2,vect1, points(:,4:5));
GIANNI GORGOGLIONE
end
Affine transformation
Description: This programmes calls a function which computes the affine transformation
% parameters for given matrices with coordinates of points in two co-ordinate systems.
% Next it computes the RMS value of the transformation and prints the RMS value.
% Finally plots the values of the control points, both for the original coordinates
% and the transformed co-ordintates, so that there is a visual evaluation of the transformation.
%
% clear
% format short
%This part is to load the poin matrix with co-ordinates of the common points in
%the two co-ordinate systems and to call the function that computes the
%affine transformation parameters Xo,Yo, alpha, beta, mx, my
GIANNI GORGOGLIONE
points = load('gcp.txt');
affine1(points)
[Xo,Yo,alpha,beta,mx,my] = affine1(points)
%This part is to calculate the co-orfinates of the control points using the
%affine transformation parameters.
Xaf=Xo+mx*cos(alpha)*points(:,4)-my*sin(alpha+beta)*points(:,5)
Yaf=Yo+mx*sin(alpha)*points(:,4)+my*cos(alpha+beta)*points(:,5)
RMS_sum=0
[numberofpoints,y] = size(points)
for i=[1:numberofpoints]
Sx=points(i,2)-Xaf(i,1);
Sy=points(i,3)-Yaf(i,1);
RMS_sum=RMS_sum+((Sx)^2+(Sy)^2);
end
RMS=sqrt(RMS_sum\8)
%%This part is to plot the original values as well the trandformed values
plot(points(:,2),points(:,3),'or'); hold on
plot(Xaf(:,1),Yaf(:,1),'ob');
GIANNI GORGOGLIONE