Depth from focus by a smartphone camera (Nokia N900)

Depth of the scene can be estimated from focus. By changing the distance between the sensor and lens (while keeping the object still relative to the camera), and taking pictures at different sensor positions, depth can be estimated based on the sharpness of the captured images. The image region that is on focus tells about the depth information. The method works as well by moving objects while keeping the distance between the lens and sensor unchanged. However, the method is workable only if the object surface is of high frequency. For more details, see Nayar 1992.

Images

  Captured images:

The object in the scene is kept still from the camera, while the distance between the sensor and lens changes, during which the images are captured at different sensor positions. On the left, the two pictures were captured w/ far and near focus respectively by Nokia N900. The lightness channel (the images on the right) is used only to estimate the depth of the scene.

The nearest focus for Nokia N900 is 0.05m, and the focal length (f) of Nokia N900 cannot be changed.

  Depth of the scene estimated:

The depth of the scene is estimated. The relative depth difference between the two boards printed with 'A's is estimated to be 5cm, the same as the measeured distance.

Slides

Algorithms

Shape from Focus