Monday, September 08, 2008
Activity 14: Stereometry
An apt continuation from our previous activity, the photometric stereo, is stereometry. Both uses the word stereo which I explained earlier also means (other than carrying the impression of "sound") two or more images being "linked" in order to create a new set of data. In this case, information that would enable us to construct a 3D image from 2D images. The geometry involved is all in the lecture given by Dr. Soriano so I'll instead move on to the data I have and from there breeze through the methodology I performed to obtain the desired results.

Stereometry basically mimics how our eyes enable us to acknowledge depth. We have two eyes and they have a set distance from each other therefore the image they obtain carry different distances even if they are both looking at the same thing. This is the reason why a one eyed man finds it hard to walk down a flight of stairs, he only perceives information from one eye (therefore one distance), therefore his brain processes only a 2D terrain and not an actual flight of stairs!

Having said that, this process of "our two eyes give depth" is the fundamental concept for stereometry. But instead of "two eyes" we shifted the image instead, which theoretically, is the same thing.

The A matrix from Activity 11 is shown below:

Using the RQ factorization code:
A=[-19.4474 18.63791 0.015063 0.031739; -5.37533 -5.41429 25.37679 -0.34856; -0.01566 -0.01596 -0.00419 1]
function [R,Q]= rq(A)
m = size(A,1);
n = size(A,2);
if n < m
error(’RQ requires m <= n’)
end
P = mtlb_fliplr(mtlb_eye(m));
AtP = A’*P;
[Q2,R2] = qr(AtP);
bigperm = [P zeros(m,n-m); zeros(n-m,m) mtlb_eye(n-m)];
Q = (Q2*bigperm)’;
R = (bigperm*R2*P)’;
We obtain that the focal length of the camera is 5.6 mm.
Moving on, we crop only the part of the image we need, we then proceed on implementing the code shown below to obtain a 3D reconstruction of the surface of the image.
b = 50;
f = 56;
x1 = [425.83333 408.33333 447.70833 389.375 428.75 469.58333 367.5 409.79167 431.66667 453.54167 389.375 433.125 481.25 415.625 459.375 441.875 366.04167 387.91667 414.16667 459.375 478.33333 494.375 364.58333 386.45833 399.58333 412.70833 436.04167 457.91667 466.66667 475.41667 491.45833 363.125 383.54167 408.33333 436.04167 456.45833 473.95833 490];
x2 = [341.25 326.66667 363.125 304.79167 344.16667 387.91667 281.45833 323.75 344.16667 412.70833 301.875 347.08333 392.29167 326.66667 367.5 351.45833 280 300.41667 325.20833 370.41667 392.29167 411.25 280 300.41667 313.54167 323.75 347.08333 370.41667 379.16667 390.83333 409.79167 280 300.41667 322.29167 347.08333 370.41667 389.375 408.33333];
y = [172.70833 165.41667 165.41667 155.20833 156.66667 155.20833 145 145 145 145 133.33333 133.33333 133.33333 121.66667 121.66667 112.91667 117.29167 108.54167 93.958333 93.958333 105.625 114.375 89.583333 80.833333 86.666667 67.708333 56.041667 67.708333 85.208333 80.833333 91.041667 64.791667 53.125 41.458333 31.25 44.375 58.958333 69.166667];
z = b*f./((x2 - x1));
x = x1;
np = 50;
xp = linspace(0,1,np); yp = xp;
[XP, YP] = ndgrid(xp,yp);
xyz = [x' y' z'];
XP = XP*38;
YP = YP*38;
ZP1 = eval_cshep2d(XP, YP, cshep2d(xyz));
xset("colormap", jetcolormap(64))
xbasc()
plot3d1(xp, yp, ZP1, flag=[2 2 4])
posted by poy @ 7:10 PM  
0 Comments:
Post a Comment
<< Home
 
 
About Me

Name: poy
Home: Quezon City, NCR, Philippines
About Me:
See my complete profile
Previous Post
Archives
Template by
Blogger templates