Photometric Stereo (Ansuman Kar - CSEP576 Project 3)
The first 3 stages of the project - lighting calibration,
solving for normals and
solving for albedos were relatively
straight forward. I got stuck with the last part of solving for depths. Though
the normals and albedos looked very similar to the results of the sample
executable, my initial depth results had very large ranges for z
and delta_new.
Turning on the debug I found that delta_new would diverge very quickly.
Findings:
- After
much soul searching & staring at code I found that I was updating the
members in the M matrix the wrong way by invoking M.get(i,j) which would compile & run OK but produced incorrect
results. Instead by invoking them as M(i,j) this problem was fixed.
- Another
minor issue was the lighting directions produced by my executable which
were varying from the results of the sample executable in the range of 0.1
or so. By altering the cutoff threshold (pixel intensity for considering a
pixel in the lighting direction calculation) from 0.9 to 0.97 I got much
better results.
- Then
there was the issue of effects produced by shadows in the normals &
albedos. This was corrected by multiplying both sides in computeOneNormal in Normals.cpp by
the pixel intensity so that effects due to shadows are reduced.
- A
fourth observation was that in the call to solveQuadratic in Depths.cpp, the number of iterations was
fixed to 300. Now, the cutoff in cg.h is both iterations and the lower
threshold of CGEpsilon for errors. Using a larger value for iterations
maximum produces better results.
Results:
(Click on the link
underneath each image to view the detailed results. Pages are best viewed with
maximized window)
buddha owl rock
Finally the light directions calculated.