Vocabulary Similarity transformations Congruence transformations.
Empirical Transformations
-
Upload
gianni-gorgoglione -
Category
Documents
-
view
13 -
download
0
description
Transcript of Empirical Transformations
NGEN06 GIS ALGORITHMS GIANNI GORGOGLIONEEMPIRICAL TRANSFORMATIONS
EMPIRICAL TRANSFORMATIONS IN THE EUCLIDEAN PLANE
Preparation1. Equation for affine transformation in the plane:
X=Xo+x*mx*cos - y*my*sin(+)=o+x*mx*sin + y*my*cos(+)
Where Xo, Yo, mx, my, , are the 6 parameters of the transformation and X, Y, x, y are the co-ordinates of points in the two co-ordinate systems.
2. We can rewrite the above equations of the affine transformation as follows:
X= a+a1*x + 2*yY=bo+b1*x+b2*y
where: a=Xo, a1= mx*cos, 2= - my*sin(+) bo=Yo, b1= mx*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*y1X2= a+a1*x2+ 2*y2X3= a+a1*x3+ 2*y3
Y1=bo+b1*x1+b2*y1Y2=bo+b1*x2+b2*y2Y3=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
= arctan (b1/ a1) = arctan(-2/ b2) - arctan(b1/ a1)
mx=SQRT(a12+b12) my=SQRT((a22+b22)
Task
The matlab files with the finction and the code are included in the .zip file
Affine functionfunction [Xo,Yo,alpha,beta,mx,my] = affine1(points);%function affine1 that computes the 6 unknown parameters of affine%transformation% Detailed explanation goes herepoints = load('gcp.txt');X= points(:,2);Y= points(:,3);
% Here we create a matrix with elements 1[numberofpoints,y] = size(points)for i=[1:numberofpoints] vect1(i,1)= 1;end
% Here we join the "1" elements and the x,y co-ordinates in one matrix.xy= cat(2,vect1, points(:,4:5));
% Here we compute the six parameters of the transformation.a=xy\X;b=xy\Y;Xo = a(1,1)Yo = b(1,1)alpha = atan(b(2,1)/a(2,1))beta = atan (-a(3,1)/b(3,1)) - atan(b(2,1)/a(2,1))mx = sqrt(a(2,1)^2+b(2,1)^2)my = sqrt(a(3,1)^2+b(3,1)^2)
end
Affine transformationDescription: 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
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)
%% This part is to compute the RMS value of the transformation
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%%of the control points.
plot(points(:,2),points(:,3),'or'); hold onplot(Xaf(:,1),Yaf(:,1),'ob');