Photometric stereo is the technique of extracting shapes from shadow.
We can estimate the shape of the surface by capturing multiple images of the sources at different locations. The information about the surface will be coded in the shadings obtained from the images.
In this activity we are given synthetic images of a sphere illuminated by a point source located respectively at
V1 = {0.085832, 0.17365, 0.98106}
V2 = {0.085832, -0.17365, 0.98106}
V3 = {0.17365, 0, 0.98481}
V4 = {0.16318, -0.34202, 0.92542}.
The figure below shows the multiple images
The program that I used is
//// four synthetic images of a sphere
loadmatfile('C:\Documents and Settings\VIP\Desktop\186 a17\Photos.mat');
I(1,:) = I1(:)';
I(2,:) = I2(:)';
I(3,:) = I3(:)';
I(4,:) = I4(:)';
scf(1);
subplot(2,2,1);
imshow(I1,[]);
subplot(2,2,2);
imshow(I2,[]);
subplot(2,2,3);
imshow(I3,[]);
subplot(2,2,4);
imshow(I4,[]);
///// Light source locations
V1 = [0.085832 0.17365 0.98106];
V2 = [0.085832 -0.17365 0.98106];
V3 = [0.17365 0 0.98481];
V4 = [0.16318 -0.34202 0.92542];
V = [V1;V2;V3;V4];
//// eqn 10
g = inv((V')*V)*(V')*I;
//// eqn 11
//absg=abs(g);
absg = ((g(1,:).^2 + g(2,:).^2 + g(3,:).^2).^0.5);
n(1, :) = g(1,:)./(absg + 0.00000000000000001);
n(2, :) = g(2,:)./(absg + 0.00000000000000001);
n(3, :) = (g(3,:)./(absg +0.00000000000000001))+ 0.00000000000001;
////eqn 14
dfdx = -(n(1,:))./n(3,:);
dfdy = -(n(2,:))./n(3,:);
root=sqrt(length(absg))
dfdx = matrix(dfdx, [root,root]);
dfdy = matrix(dfdy, [root,root]);
//// eqn 15
z = cumsum(dfdx, 2) +cumsum(dfdy, 1);
scf(2);
plot3d(1:root, 1:root, z);
The reconstruction is
It shows a half hemisphere although there are some ridges due to the abrupt changes in the shading
In this activity, I give myself a grade of 10 since I was able to do the reconstruction.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment