Depth Map generation from 2D image by Google AI



Please read these documents

Learning the Depths of Moving People by Watching Frozen People



We will install Google MannequinChallenge on Windows 10 64bit and introduce SPM to create the depth maps from 2D images.

1. Windows 10 64bit
2. CUDA compatible nVidia video card (I think we have an error if the video memory is small)
If does not work in your PC, Try this "Creating depth maps from 2D images using Google Colab"

1. Install Python
Download and install "Windows x86-64 executable installer"

After install python, press 'python' in command prompt

After install python, press 'python' in command prompt for verification. Press 'Crtl + Z' for quitting python mode.

2. Install Visual Studio 2015 runtime version
Microsoft Visual C++ 2015 Redistributable Update 3

This is need for importing pytorch.

3. Install Pytorch
Visit Pytorch page to get pip command

Open command prompt as administrator,then press pip command as follows,
pip3 install

Next step, input following pip command for installing torchvision
pip3 install

Press 'python' in command prompt, then input 'import torch' for verification.
If you find an error, please search it with Google.
Press 'Crtl + Z' for quitting python mode.

4. Install "scikit-image","h5py","scipy"

5. Download following zip file, then extract in the root of C drive.
Attention) It does not operate except "c:/2dtodepth" folder.
I changed some code from the original file on Github.
-Changed to work on Windows
-Modified to work with SPM
-Create depth map of all files in source folder
-Hold the aspect ratio of input image
-Use the orientation tag of the EXIF image
-Specify the type of the depth map (white front / black front)

How to use
1. Put in your 2d images in 'c:/2dtodepth/infile'
2. Double click on 'c:/2dtodepth/prog/2dtodepth.bat' (batch file) for running scrit.
3. After script finish, you can find SBS(2D+Depth) images in 'c:/2dtodepth/outfile'.

The latest StereoPhoto Maker can load this script.
1. Open your 2D image as Single image.(Menu->File->Open Single Image...)
2. Menu->Edit->Depth map->Create depth map from Single Image(Google AI)
After script finish, SPM show Left(2D) Right(Depth map).