Example of a right floating element.
The goal of this project was to apply concepts of Cameras and Scene Geometry. It was broken into 3 parts.
Part 1 consisted of first finding the projection matrix and then calculating the camera center based on that matrix. To solve for the Projection Matrix, M, calculating A, the matrix of unknown camera parameters from the 2D and 3D coordinates. This is done by putting the image and world coordinations into the form: [X1 Y1 Z1 1 0 0 0 0 -u1X1 -u1Y1 -u1Z1; 0 0 0 0 X1 Y1 Z1 1 -v1X1 -v1Y1 -v1Z1; . . . Xn Yn Zn 1 0 0 0 0 -unXn -unYn -unZn; 0 0 0 0 Xn Yn Zn 1 -vnX1 -vnY -vnZn ] Where X, Y, and Z are the World (3D) coordinates, and u and v and the image (2D) coordinates.
highlighting
folder is configured to do syntax highlighting in code blocks such as the one below.
%get u and v from image coordinates
r = Points_2D(k, :);
u = r(1, 1);
v = r(1, 2);
%get X, Y, Z from the dimensions of the world coordinates
s = Points_3D(k,:);
X = s(1, 1);
Y = s(1, 2);
Z = s(1, 3);
%odd rows - u values
A(i, :) = [X Y Z 1 0 0 0 0 -u.*X -u.*Y -u.*Z -u];
%even rows - v values
A(i + 1, :) = [0 0 0 0 X Y Z 1 -v.*X -v.*Y -v.*Z -v];
%get u and v from the current row of image a
a = Points_a(k, :);
ua = a(1, 1);
va = a(1, 2);
%get u and v from current row of image b
b = Points_b(k, :);
ub = b(1, 1);
vb = b(1, 2);