-------------
 MATLAB CODE
-------------

In the code folder you will find two MATLAB scripts:
* Demo.m
* Reconstruct3d.m

Demo.m is an example of how to read and display the data in 2D and 3D.

Reconstruct3d.m shows the details of how the 3D data was reconstructed from the 2D annotation. You only need to have a look at this if you would like to improve the accuracy of this reconstruction, e.g. by adding a bundle-adjustment step.

-------------
 DATA FORMAT
-------------

Let N=14 be the number of joints.
Let C=3 be the number of cameras.
Let T be the number of frames for a sequence.

positions2d.txt stores the image coordinates as an array A of size 2xNxCxT.

positions3d.txt stores the reconstructed 3D joint positions B as an array of size 3xNxT.

cameras.txt stores the reconstructed 2x4 camera matrices as an array M of size 2x4xCxT.


In the files thise arrays are stored as one element on each row.

positions2d.txt can be read sequentially in the order:

for t=1:T
for c=1:C
for n=1:N
for i=1:2
    read A(i,n,c,t)
end
end
end
end

positions3d.txt can be read sequentially in the order:

for t=1:T
for n=1:N
for i=1:3
    read B(i,n,t)
end
end
end

cameras.txt can be read sequentially in the order:

for t=1:T
for c=1:C
for j=1:4
for i=1:2
    read M(i,j,t)
end
end
end
end

In matlab this can be done as:

N=14;
C=3;

a = load( 'positions2d.txt' );
T = length( a ) / 2 / N / C;
A = reshape( a, 2, N, C, T );

b = load( 'positions3d.txt' );
T = length( b ) / 3 / N;
B = reshape( b, 3, N, T );

m = load( 'cameras.txt' );
T = length( m ) / 2 / 4 / C;
M = reshape( m, 2, 4, C, T );


The landmark indices are defined as:

1 Right Ankle
2 Right Knee
3 Right Hip
4 Left Hip
5 Left Knee
6 Left Ankle
7 Right Wrist
8 Right Elbow
9 Right Shoulder
10 Left Shoulder
11 Left Elbow
12 Left Wrist
13 Bottom Head
14 Top Head


