PIXELBANKv9.1.0
Menu

Recover Normal from Three Lights

Implement a photometric stereo technique to recover the surface normal from intensity observations under three different light sources. Given intensities I=[I1,I2,I3]I = [I_1, I_2, I_3] from three lights with known directions, we aim to solve for the surface normal.

The underlying concept is based on the reflectance equation, which relates the observed intensity to the surface normal and light direction. Assuming unit albedo, the reflectance equation simplifies, allowing us to solve for the normal. The process involves:

  1. Setting up a system of linear equations based on the reflectance equation
  2. Solving for the surface normal using the given light directions and intensities
L⋅(ρ⋅n)=IL \cdot (\rho \cdot \mathbf{n}) = I n=L−1⋅I∥L−1⋅I∥\mathbf{n} = \frac{L^{-1} \cdot I}{\|L^{-1} \cdot I\|}

This technique is widely used in 3D reconstruction applications.

Example:

Input:
recover_normal([1, 0, 0], [[1,0,0],[0,1,0],[0,0,1]])
Output:
[1.0, 0.0, 0.0]
Reasoning:

With identity light matrix and intensities [1, 0, 0]: L^-1 = I (identity)

  • n = L^-1 × I = [1, 0, 0] ||n|| = 1 (already normalized) Normal points in +X direction.

Constraints:

  • intensities: [I1, I2, I3] from 3 light sources
  • lights: 3x3 matrix where each row is a unit light direction
  • Return unit normal [nx, ny, nz], rounded to 4 decimal places
solution.py

Test Results

0/0
Run code to see test results.