Depth Map Automatic Generator 7 (DMAG7) is an implementation of "Fast Bilateral-Space Stereo for Synthetic Defocus" by Jonathan T. Barron, Andrew Adams, YiChang Shih, and Carlos Hernández. It is a global method that uses a bilateral filter in the smoothing cost of the cost function. The cost function for which a gradient can be obtained analytically is minimized with L-BFGS.
If you'd rather read the Cliff notes rather than the paper itself, you are invited to go over Fast Bilateral-Space Stereo for Synthetic Defocus for a quick overview of the method and some pictures.
This is the first time I don't use Qt as a graphical interface (it's just too much of a hassle to deal with in windows, at least, for me). I am providing a batch file (dmag7.bat) to launch the executable from the directory the stereo pair resides on your computer. In this batch file, the path to dmag7.exe must be changed so that it is the correct path for your computer (depends on where you decompressed the archive). The input file dmag7_input.txt must also be copied onto that same directory (where the stereo pair is). It must be edited so that the names of the left and right images are correct. The various parameters in the input file are explained in dmag7_manual.pdf. Because I don't use Qt anymore, I had to write read/write routines for the main image format players. For now, the supported image file formats are: tiff, png, and jpeg.
Just to be clear, you copy dmag7.bat to where your stereo pair is, edit it so that the path is correct and double-click it to run DMAG7. You also need to copy the input file dmag7_input.txt to where your stereo pair is and edit it so that the image names are correct. The parameters that govern DMAG7's behavior can be changed by editing dmag7_input.txt. To edit a file, you can certainly use good ole "notepad" or whatever you are used to.
As always, if you have trouble with the software, send me your stereo pair and input file and I will take a look (but on my linux box). If the images are quite large, like more than 4 megapixels (which is not that large in the photography world), you may want to reduce the size just to make sure the program runs properly on your computer. Then, you can see about increasing the size but it may take a while depending on how much memory you have one board. You can monitor memory usage with windows task manager. If the memory used goes beyond your RAM memory limit and the virtual memory limit, the program will crash. If the memory goes beyond your RAM memory limit but stays below the virtual memory limit, the program will not crash but will be slow because it has to use the hard disk like it were memory (it's called paging). Ideally, you don't want paging to occur unless you don't need the computer for a while as it will be unusable until the program that's causing the paging either finishes or crashes.
The following shows a depth map produced by DMAG7 using min disparity = -50, max disparity = 4, spatial sample rate = 8, range spatial rate = 32, patch radius = 7, lambda = 0.01, max L-BFGS iterations = 1000, hash table size = 10000. The images are 1199x901.
I haven't done so in the above example but I strongly suggest smoothing the depth map obtained by DMAG7 with Edge Preserving Smoothing 7 (EPS7).
The windows executable (guaranteed to be virus free) is available for free via the 3D Software Page.
Automatic depth map generation, stereo matching, multi-view stereo, Structure from Motion (SfM), photogrammetry, 2d to 3d conversion, etc. Check the "3D Software" tab for my free 3d software. Turn photos into paintings like impasto oil paintings, cel shaded cartoons, or watercolors. Check the "Painting Software" tab for my image-based painting software. Problems running my software? Send me your input data and I will do it for you.
Hi.
ReplyDeleteGreat softwares but I tried to use this software and it crashes (maybe during the optimization). It's not a memory problem because I checked with Task Manager. I tried to use yours demo image with your input but it's the same. I don't understand what I'm getting it wrong. Can you help me?
Can you take a picture of the "console" window? The window where DMAG7 prints stuff out. You can just print the screen (using PrtScn), load it up into Photoshop or Gimp or whatever (create from ClipBoard), and then save the picture, and send it to me. Or just write down what it says. also, send me you dmag7.bat and dmag7_input.txt.
Delete