Commit 7d7ce63d authored by Daniel Bourgault's avatar Daniel Bourgault

First commit

parent a22e6e07
K 25
svn:wc:ra_dav:version-url
V 45
/svn/g_rect_package/!svn/ver/7/trunk/Examples
END
10
dir
7
http://bourda02@demeter/svn/g_rect_package/trunk/Examples
http://bourda02@demeter/svn/g_rect_package
2013-04-15T22:39:22.457529Z
7
bourda02
011fb189-60de-4f9a-bef2-e507afd36f24
Field
dir
Lab
dir
K 25
svn:wc:ra_dav:version-url
V 51
/svn/g_rect_package/!svn/ver/7/trunk/Examples/Field
END
parameters.dat
K 25
svn:wc:ra_dav:version-url
V 66
/svn/g_rect_package/!svn/ver/7/trunk/Examples/Field/parameters.dat
END
IMG_6614.JPG
K 25
svn:wc:ra_dav:version-url
V 64
/svn/g_rect_package/!svn/ver/2/trunk/Examples/Field/IMG_6614.JPG
END
10
dir
7
http://bourda02@demeter/svn/g_rect_package/trunk/Examples/Field
http://bourda02@demeter/svn/g_rect_package
2013-04-15T22:39:22.457529Z
7
bourda02
011fb189-60de-4f9a-bef2-e507afd36f24
parameters.dat
file
2013-04-15T22:40:50.000000Z
0977387bbb9e0a144a32eeffb9fdf72a
2013-04-15T22:39:22.457529Z
7
bourda02
has-props
1563
IMG_6614.JPG
file
2012-03-12T12:14:57.000000Z
4bbd1613b7408c1152f4a65b5f16e96c
2012-12-20T16:51:06.675321Z
2
bourda02
has-props
970958
K 13
svn:mime-type
V 24
application/octet-stream
END
% I/O information
imgFname = 'IMG_6614.JPG';
firstImgFname = 'IMG_6614.JPG';
lastImgFname = 'IMG_6614.JPG';
outputFname = 'g_rect.mat';
% Field or lab case situation.
% Set field = true for field situation and field = false for lab situation.
field = true;
% Camera position
% lat/lon for field situation
% meter for lab situation
LON0 = -70.6010167;
LAT0 = 47.2713000;
% Offset from center of the principal point (generally zero)
ic = 0;
jc = 0;
% Parameters
hfov = 65.0; % Field of view of the camera
lambda = 2; % Dip angle above vertical (e.g. straight down = 90, horizontal = 0)
phi = 0.0; % Tilt angle (generally close to 0).
H = 720; % Camera altitude
theta = 70.0; % View angle clockwise from North (e.g. straight East = 90)
% Uncertainty in parameters. Set the uncertainty to 0.0 for fixed parameters.
dhfov = 20.0;
dlambda = 10.0;
dphi = 5.0;
dH = 0.0;
dtheta = 20.0;
% Order of the polynomial correction (0, 1 or 2)
polyOrder = 1;
% To save memory calculation can be done in single precision.
% For higher precision set the variable 'precision' to 'double';
precision = 'double';
% Ground Control Points (GCP).
% The data must come right after the gcpData = true
gcpData = true;
360 829 -70.561367 47.303783
54 719 -70.54500 47.335
99 661 -70.505 47.375
452 641 -70.435 47.389
429 633 -70.418 47.408
816 644 -70.393 47.368
\ No newline at end of file
% I/O information
imgFname = 'IMG_6614.JPG';
firstImgFname = 'IMG_6614.JPG';
lastImgFname = 'IMG_6614.JPG';
outputFname = 'g_rect.mat';
% Field or lab case situation.
% Set field = true for field situation and field = false for lab situation.
field = true;
% Camera position
% lat/lon for field situation
% meter for lab situation
LON0 = -70.6010167;
LAT0 = 47.2713000;
% Offset from center of the principal point (generally zero)
ic = 0;
jc = 0;
% Parameters
hfov = 65.0; % Field of view of the camera
lambda = 2; % Dip angle above vertical (e.g. straight down = 90, horizontal = 0)
phi = 0.0; % Tilt angle (generally close to 0).
H = 720; % Camera altitude
theta = 70.0; % View angle clockwise from North (e.g. straight East = 90)
% Uncertainty in parameters. Set the uncertainty to 0.0 for fixed parameters.
dhfov = 20.0;
dlambda = 10.0;
dphi = 5.0;
dH = 0.0;
dtheta = 20.0;
% Order of the polynomial correction (0, 1 or 2)
polyOrder = 1;
% To save memory calculation can be done in single precision.
% For higher precision set the variable 'precision' to 'double';
precision = 'double';
% Ground Control Points (GCP).
% The data must come right after the gcpData = true
gcpData = true;
360 829 -70.561367 47.303783
54 719 -70.54500 47.335
99 661 -70.505 47.375
452 641 -70.435 47.389
429 633 -70.418 47.408
816 644 -70.393 47.368
\ No newline at end of file
K 25
svn:wc:ra_dav:version-url
V 49
/svn/g_rect_package/!svn/ver/2/trunk/Examples/Lab
END
IMG_8368.jpg
K 25
svn:wc:ra_dav:version-url
V 62
/svn/g_rect_package/!svn/ver/2/trunk/Examples/Lab/IMG_8368.jpg
END
parameters.dat
K 25
svn:wc:ra_dav:version-url
V 64
/svn/g_rect_package/!svn/ver/2/trunk/Examples/Lab/parameters.dat
END
10
dir
7
http://bourda02@demeter/svn/g_rect_package/trunk/Examples/Lab
http://bourda02@demeter/svn/g_rect_package
2012-12-20T16:51:06.675321Z
2
bourda02
011fb189-60de-4f9a-bef2-e507afd36f24
IMG_8368.jpg
file
2012-12-18T18:09:59.000000Z
2eb6933a87131a15b4eefddf78667242
2012-12-20T16:51:06.675321Z
2
bourda02
has-props
2861752
parameters.dat
file
2012-12-18T18:09:59.000000Z
f5f5418e8bfd604a426f5cebd9821688
2012-12-20T16:51:06.675321Z
2
bourda02
has-props
1635
K 13
svn:mime-type
V 24
application/octet-stream
END
% I/O information
imgFname = 'IMG_8368.jpg';
firstImgFname = 'IMG_8368.jpg';
lastImgFname = 'IMG_8368.jpg';
outputFname = 'IMG_8368.mat';
% Field or lab case situation.
% Set field = true for field situation and field = false for lab situation.
field = false;
% Camera position
% lat/lon for field situation
% meter for lab situation
LON0 = 1.01;
LAT0 = 2.36;
% Offset from center of the principal point (generally zero)
ic = 0;
jc = 0;
% Parameters
hfov = 62.00; % Field of view of the camera
lambda = 53.0; % Dip angle below horizontal (e.g. straight down = 90, horizontal = 0)
phi = 1.0; % Tilt angle (generally close to 0).
H = 1.755; % Camera altitude (m)
theta = 180.0; % View angle anticlockwise from North (e.g. straight East = 270)
% Uncertainty in parameters. Set the uncertainty to 0.0 for fixed parameters.
dhfov = 5.0;
dlambda = 10.0;
dphi = 5.0;
dH = 0.5;
dtheta = 20.0;
% Order of the polynomial correction (0, 1 or 2)
polyOrder = 2;
% To save memory calculation can be done in single precision.
% For higher precision set the variable 'precision' to 'double';
precision = 'double';
% Ground Control Points (GCP).
gcpData = true;
2999 226 0.500 0.00
1694 220 1.500 0.00
528 677 2.290 0.50
289 1231 2.290 1.00
3819 686 0.000 0.50
4018 1266 0.000 1.00
2566 1235 0.890 0.99
3806 2118 0.255 1.56
4131 1580 0.000 1.23
521 2548 1.910 1.82
248 2328 2.060 1.71
14 1868 2.290 1.46
% I/O information
imgFname = 'IMG_8368.jpg';
firstImgFname = 'IMG_8368.jpg';
lastImgFname = 'IMG_8368.jpg';
outputFname = 'IMG_8368.mat';
% Field or lab case situation.
% Set field = true for field situation and field = false for lab situation.
field = false;
% Camera position
% lat/lon for field situation
% meter for lab situation
LON0 = 1.01;
LAT0 = 2.36;
% Offset from center of the principal point (generally zero)
ic = 0;
jc = 0;
% Parameters
hfov = 62.00; % Field of view of the camera
lambda = 53.0; % Dip angle below horizontal (e.g. straight down = 90, horizontal = 0)
phi = 1.0; % Tilt angle (generally close to 0).
H = 1.755; % Camera altitude (m)
theta = 180.0; % View angle anticlockwise from North (e.g. straight East = 270)
% Uncertainty in parameters. Set the uncertainty to 0.0 for fixed parameters.
dhfov = 5.0;
dlambda = 10.0;
dphi = 5.0;
dH = 0.5;
dtheta = 20.0;
% Order of the polynomial correction (0, 1 or 2)
polyOrder = 2;
% To save memory calculation can be done in single precision.
% For higher precision set the variable 'precision' to 'double';
precision = 'double';
% Ground Control Points (GCP).
gcpData = true;
2999 226 0.500 0.00
1694 220 1.500 0.00
528 677 2.290 0.50
289 1231 2.290 1.00
3819 686 0.000 0.50
4018 1266 0.000 1.00
2566 1235 0.890 0.99
3806 2118 0.255 1.56
4131 1580 0.000 1.23
521 2548 1.910 1.82
248 2328 2.060 1.71
14 1868 2.290 1.46
function [Xc,Xp] = Compute3D(xc,xp,R,T,fc,fp,cc,cp,kc,kp,alpha_c,alpha_p);
% [Xc,Xp] = Compute3D(xc,xp,R,T,fc,fp,cc,cp,kc,kp,alpha_c,alpha_p);
%
% Reconstruction of the 3D structure of the striped object.
%
% Xc : The 3D coordinates of the points in the camera reference frame
% Xp : The 3D coordinates of the points in the projector reference frame
%
% xc, xp: Camera coordinates and projector coordinates from ComputeStripes
% R,T : rigid motion from camera to projector: Xp = R*Xc + T
% fc,fp : Camera and Projector focal lengths
% cc,cp : Camera and Projector center of projection
% kc,kp : Camera and Projector distortion factors
% alpha_c, alpha_p: skew coefficients for camera and projector
%
% The set R,T,fc,fp,cc,cp and kc comes from the calibration.
% Intel Corporation - Dec. 2003
% (c) Jean-Yves Bouguet
if nargin < 12,
alpha_p = 0;
if nargin < 11,
alpha_c = 0;
end;
end;
Np = size(xc,2);
xc = normalize_pixel(xc,fc,cc,kc,alpha_c);
xp = (xp - cp(1))/fp(1);
xp_save = xp; % save the real distorted x - coordinates + alpha'ed
if (norm(kp) == 0)&(alpha_p == 0),
N_rep = 1;
else
N_rep = 5;
end;
% xp is the first entry of the undistorted projector coordinates (iteratively refined)
% xc is the complete undistorted camera coordinates
for kk = 1:N_rep,
R2 = R([1 3],:);
if length(T) > 2,
Tp = T([1 3]); % The old technique for calibration
else
Tp = T; % The new technique for calibration (using stripes only)
end;
% Triangulation:
D1 = [-xc(1,:);xc(1,:).*xp(1,:);-xc(2,:);xc(2,:).*xp(1,:);-ones(1,Np);xp(1,:)];
D2 = R2(:)*ones(1,Np);
D = sum(D1.*D2);
N1 = [-ones(1,Np);xp(1,:)];
N2 = -sum(N1.*(Tp*ones(1,Np)));