Saturday, April 20, 2013

Depth Map Automatic Generator (DMAG)

Depth Map Automatic Generator (DMAG) automatically generates a depth/disparity map given a stereo pair. The algorithm is based upon stereo matching variational methods in the context of optical flow.

DMAG is an implementation of the algorithm described in High Accuracy Optical Flow Estimation Based on a Theory for Warping by Thomas Brox, A. Bruhn, N. Papenberg, J. Weickert and Robust Optical Flow Estimation by Javier Sánchez Pérez, Nelson Monzón López, Agustín Salgado de la Nuez.

The only parameter to worry about is the smoothness parameter since it's the only parameter which, when changed, produces major differences in the resulting depth maps. If the depth map looks oversmoothed, the smoothness parameter should probably be decreased.

It is strongly recommended not to use images that are wider than 2,000 pixels since the CPU time spent becomes a real issue (as well as memory but to a much lesser extent). Reducing the number of (outer) iterations can certainly help in reducing the cpu time.

Here's an example:


Left image (image 1).



Right image (image 2).



Depth map obtained by DMAG.


Here's another example:


Left image (image 1).



Right image (image 2).



Depth map obtained by DMAG.


More details about DMAG can be found in Depth Map Generation using Optical Flow by Ugo Capeto.

The windows executable (guaranteed to be virus free) is available for free via the 3D Software Page. Please, refer to the 'Help->About' page in the actual program for how to use it.

Source code: DMAG on github.

6 comments:

  1. I have recently try this software with L-R photos extracted from W3's MPO. After execute for a while it throws. May I have some hints on how to use it?

    ReplyDelete
  2. Hey, I was having issues with PNG images until I read this: reduce the size. Voila it's no longer throwing.

    ReplyDelete
  3. Why PNG? Saving as a PNG generates a transparent background. With a flat image, edge to edge, no background will show. Saving as a simple, uncompressed jpg is best.

    ReplyDelete
    Replies
    1. PNG image generates transparency's if you apply the alpha option.

      Delete
  4. I just tried it. Fantastic! Thank you so much for writing this.

    ReplyDelete