Photometric Stereo and Depth Map Reconstruction
Implementing photometric stereo to recover surface normals, constructing a canonical view, computing a 3D depth map, and validating consistency between image and geometry representations.
Photometric Stereo and Depth Map Reconstruction
Overview
A. Implementing Photometric Stereo to Understand Shape Cues from Shading
1. Canonical View Image via Photometric Stereo
- Computed a grayscale Lambertian surface image from photometric stereo using unit-normalized surface normals.
- Only the Z-component of the normalized normal vectors affects pixel brightness (orthographic projection assumption).
- Brighter regions (closer to white) have normals pointing directly at the camera at (0,0,1).
- No black regions imply no surface normals are perpendicular or back-facing to the camera.
2. Depth Map Computation
- Derived depth map by integrating partial derivatives:
- fx = nx / nz
- fy = ny / nz
- Used cumulative summation in MATLAB to integrate over a 400×400 zero-initialized depth matrix.
- Visualized with
meshgrid()
andsurf()
; lighting added to enhance 3D perception. - Resulting surface is sinusoidal in nature with visible peaks, troughs, and saddle regions.
3. Relation Between Depth Map and Canonical Image
- Bright (white) regions in the canonical image correspond to flat or perpendicular regions in the depth map.
- Depth perception (peak vs. trough) cannot be distinguished from the canonical image alone due to loss of directional information.
- Derivative signs from surface normals imply gradient direction for constructing height.
4. Reconstructing Canonical Image from Depth Map
- Recomputed surface normals from depth gradients:
- Normal vector at each point: (−fx, −fy, 1), normalized.
- Z-component of these normals was reused to recreate the grayscale canonical image.
- The result matches the original pattern, validating the depth computation.
- Minor noise artifacts appear, likely due to rounding errors during division and normalization.
Conclusion
This assignment demonstrates how photometric stereo can be used to extract 3D geometry from shading and how surface normals and gradients interrelate. The consistent reconstruction of the canonical image from depth data confirms the soundness of the pipeline.
This post is licensed under CC BY 4.0 by the author.