wang81522472 / comp5421pa4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

COMP5421 Project 4

This project implements Photometric Stereo via Expectation Maximization by Tai-Pang Wu and Chi-Keung Tang.

Algorithm description

Uniform Resampling

First we need to quantize all the possible directions. We use the vertices of the upper half of a subdivided icosphere at level 4. We use code from here.

Then we interpolate the images with light directions as the quantized ones. The original light directions each has a nearest quantized direction and some quantized directions are nearest directions of multiple original directions. For this quantized direction, the set V contains these multiple original directions. Now we can interpolate the images by the formula.

Find Denominator Image

Find denominator image by the following steps.

  1. Calculate the intensity percentile of each position over all the images.
  2. For each image, count the number of pixel with percentile > 70%, k_L.
  3. For each image, calculate the average percentile of the pixels with percentile > 70%, r. And calculate the percetile of each r.
  4. Discard all the images that the percentile of r > 90%.
  5. Choose the image with the largest k_L from the remaining images.

Calculate Initial Normal

Divide each image by the denominator image to get ratio images. For each position in each ratio image, we have this equation.

Imgur

In total we have N-1 equations for each pixel. Solve the system by SVD.

Refine the Normal by Graph Cut

Again we quantize the possible directions by the upper half of a icosphere at level 5. And we use them as labels and want to assign these finite labels to each pixel so that the energy is minimized.

Imgur

Visualization

We can get the surface plot by the following steps.

  1. Vertically flip the normal map.
  2. Convert normal to gradient (-N(1)/N(3), -N(2)/N(3)).
  3. Convert gradient to slant and tilt by this tool.
  4. Convert slant and tilt to depth map.
  5. Plot depth map by Matlab surf function.

Result

The initial normal map, refined normal map, refined surface and refined surface with texture.

Imgur Imgur Imgur Imgur

Imgur Imgur Imgur Imgur

Imgur Imgur Imgur Imgur

Imgur Imgur Imgur Imgur

Imgur Imgur Imgur Imgur

Imgur Imgur Imgur Imgur

Imgur Imgur Imgur Imgur

Imgur Imgur Imgur Imgur

About


Languages

Language:C++ 77.2%Language:MATLAB 22.8%