summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/toolbox_basic/TOOLBOX_calib/Rectangle2Square.m
blob: a6bbbe5b0627ebfe31b90df10c554e4beeeece1c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function [square] = Rectangle2Square(rectangle,L,W);

% Generate the square from a rectangle of known segment lengths
% from pt1 to pt2 : L
% from pt2 to pt3 : W

[u_hori,u_vert] = UnWarpPlane(rectangle);

coeff_x = sqrt(W/L);
coeff_y = 1/coeff_x;

x_coord = [ 0 coeff_x  coeff_x 0];
y_coord = [ 0 0 coeff_y coeff_y];


square = rectangle(:,1) * ones(1,4) + u_hori*x_coord + u_vert*y_coord;
square = square ./ (ones(3,1)*square(3,:));