Monday, August 25, 2008

A14 - Stereometry

Stereometry is another 3D reconstruction algorithm based on the human eye perception of depth. We perceive depth by viewing the same object at two different angles (two eyes separated by some distance).

In this activity, we explore how stereometry works. We try to reconstruct a 3D object using 2 images of taken by the same camera at the same distance z from the object but with a different x position (assuming x is the parallel axis between the camera and the object).


From this diagram, by simple ratio and proportion, depth z is perceived using the relation
(1)

If done on several points, we can reconstruct the 3D surface of the object.

The sample I used is a rubik's cube shown below with the tsai grid. (b=50mm, refer to diagram)



The camera used was first calibrated to get its internal parameter f (focal length). From the a's calculated using Activity 11 – Camera Calibration, matrix A is formed by recasting the a's. We then get the values of matrix A(1:3,1:3) and factorize this using RQ factorization, to get upper diagonal matrix K. (Note: Ensure that the factorized A(3,3) element is 1 by dividing the matrix by K(3,3)). The K-matrix obtained is shown below.



Knowing that K is just

and
we now have a value for focal length f (let kx=1);

We then get z values (using the equation 1) for different points on the object (purple dots).



Reconstruction was done using Matlab's griddata instead of SciLab's splin2d because of the latter's initial requirement of increasing values for both x and y image coordinates. Matlab's griddata function, however, works well for random values of x and y image coordinates.

Reconstruction of the rubik's cube is shown below.





It may not seem obvious but the reconstruction obtained the general height difference of the points selected. The edges are not defined but it somehow approximates the shape of the rubik's cube.

---
Thanks Cole for helping me with the images and JC for the discussions with regards to reconstruction.

---
Rating 6/10 since
1. reconstruction is not that good
2. I used Matlab in reconstruction rather than SciLab
3. I posted this blog very late.

No comments: