Compiling and Running Make3D on your own computer

Make3d has the ability to infer depth from a single 2D image. For more information on how it works see

The code is available under Creative Commons Attribution-Noncommercial 3.0 unported license. To use the code, you must agree to cite the papers number 1 (TPAMI), 3 (ICCV-3dRR), and 9 (NIPS) available here, and the url:

What you need
1) A computer running a linux distro (Ubuntu is recommended, but we have been able to run it everywhere including RedHat and amazon clusters). Standard build tools (g++, gcc etc)

2) Matlab

3) Mex compiler to compile C++ bindings to MatLab


Step 1) Download and untar the make3d files as follows (I assume everything is done in the home directory)

cd ~
mkdir make3d
cd make3d
mkdir params
mkdir scratch
tar -xvzf Make3dSingleImageStanford_version0.1.tar.gz
cd params
tar -xvzf  MakedLearnedParameters_v0.1.tar.gz
cd ..

Step 2) Set the default directories for loading/storing training data and scratch data
Since we don’t want to have to pass these as arguments every time we are just going to modify the “OneShot3dEfficient.m” file to store these as defaults.

Go to the make3d/LearningCode/Debug and open the file OneShot3dEfficient.m
You will see several lines like the following (around lines 72-87)

ScratchFolder = ['/afs/cs/group/reconstruction3d/scratch/IMStorage' ];
ParaFolder = '/afs/cs/group/reconstruction3d/scratch/Para/';

change them to:

ScratchFolder = ['~/make3d/scratch' ];
ParaFolder = '~/make3d/params/';

(i.e pointing to the two folders we made earlier)

Step 3) Generate the various mex needed:
cd to ~/make3d/LearningCode
run MatLab
in matlab type:

>> InitialPath(true)

This will generate all the .mex files needed for the program to run

Now you probably want to download a test image to the
~/make3d/LearningCode directory … do that then restart matlab


>> InitialPath(false)
>> OneShot3dEfficient('yourimage.jpg','./')

You should see something like the following be outputted:

>> InitialPath(false)
>> OneShot3dEfficient('paris.jpg','./')
Starting with new optimization...
Default = 

         filename: {'_'}
       ParaFolder: '~/make3d/params/'
     OutPutFolder: './'
    ScratchFolder: '~/make3d/scratch'
             Flag: [1x1 struct]

0.027535 seconds.
Loading the image...               0.2733 seconds.
Creating Superpixels...           3.0314 seconds.
Creating Features and multiple segmentations... 32.9655 seconds.
Calculating superpixel-shape features...       33.6513 seconds.
Preparation for the Inference...             39.8886 seconds.
Starting Inference...
     : Building Matrices....            2.1074
     : In 1st level Optimization, using new solver.(1/1,1/1) Success with alfa=1192.3985 Success with alfa=1635.6242     35.722
     : Writing WRL.grid 0attach 0            In WRL, vertices=2567 triangles=4691
Finished Inference at:         79.5021 seconds.
Writing superpixels and image...  79.8306 seconds.
Done.        Total time taken = 79.832 seconds.

Thats all there is to it! You now have a .WRL file containing the outputted 3d model

Viewing the 3D WRL

There are many viewers to see the .WRL file. For example, you can install Cortona viewer and view in Chrome or Firefox browser.

Thanks to Salik Syed for producing this how-to instructions.