Sunday, February 21, 2010

3D Video Scanner for Cheap

Here's a way you might try making a 3D video scanner for the cost of a webcam:

  • Weccam with VSYNC broken out
  • Bright LED or LED array
  • Ambient illumination

Mount the LED at approximately the same location as the camera lens. Turn the LED on for alternating VSYNC pulses. The 3D decoding process is as follows: the light intensity at every point can be modeled using the equation i = r * (a + s), where:

  • i is the captured intensity at that pixel
  • r is the reflectivity at that point
  • a is the ambient illumination at that point
  • s is the illumination due to the LED source at that point

Sampling with the LED on and off yields two equations:

  1. i_on = r * (a + s)
  2. i_off = r * (a + 0)

And s corresponds to distance proportionally to an inverse square law:

  • s(d) = f / d^2

Where f is a scaling factor that relates s to a. Solving for d yields:

  • i_off = r * a
  • i_off / a = r
  • i_on = (i_off / a) * (a + (f / d^2))
  • ((a * i_on) / i_off) - a = f / d^2
  • a * ((i_on / i_off) - 1) = f / d^2
  • d = sqrt(f / (a * ((i_on / i_off) - 1)))

The values for a and f can be approximated by hand, or calibrated based on a reference plane. a must be truly uniform, but if the LED is approximately at the same location as the lens then f can be calibrated for automatically to account for its non-point-source qualities.

The disadvantages here are primarily the assumption about ambient illumination, and the simplified material model. The advantages would be the cost and utter simplicity. The fact that it relies on a non-coded point source for illumination means you can work with infrared just as easily as visible light. Furthermore, it actually relies on ambient illumination while many other systems try to minimize it.

No comments: