📘
Surface Integration from Normals
MediumCV
Implement a method to integrate surface normals and recover a depth map, a crucial step in 3D Reconstruction using Photometric Stereo. This process involves calculating the surface gradient from given normals.
The surface gradient is a fundamental concept in Computer Vision, representing the rate of change of the surface depth in the x and y directions. Given the surface normals nx, ny, nz, the surface gradient can be calculated as p=−nx/nz and q=−ny/nz, which are essential for integrating the surface.
To integrate the surface, follow these steps:
- Calculate the surface gradient p and q from the given normals.
- Use the calculated p and q in a Poisson equation solver to obtain the depth Z.
This technique is widely used in 3D scanning and object recognition applications.
Example:
Input:
Normal map
Output:
Depth map
Reasoning:
Compute gradients from normals, integrate using Poisson
Constraints:
- Input normals: 2D numpy array of shape (height, width, 3) with dtype float32, representing the surface normals nx, ny, nz
- Valid ranges: nz values are non-zero, and all normal values are normalized to have a length of 1
- Output depth map: 2D numpy array of shape (height, width) with dtype float32, representing the recovered depth Z with precision up to 6 decimal places
- Special conditions: The input normals are assumed to be noise-free and the surface is assumed to be Lambertian and convex
- Boundary conditions: The depth values at the boundary of the image are assumed to be zero, and the Poisson equation solver should handle the boundary conditions accordingly
Editor
Python 3.13.1
Test Results
0/0Run code to see test results.