## Monday, December 7, 2015

### 3D Photos - Flowers (Middlebury 2014)

Flowers is part of the Middlebury 2014 Stereo datasets. It's a "perfect" stereo pair, meaning that it's perfectly rectified and there's no illumination variation between the left and right images. Also, the focus and colors are the same. When you take a picture with a stereo rig, that's not always the case.

Left image (800 pixels wide).

Right image (800 pixels wide).

The original stereo pair is 2880x1980, which is a bit too big for my blood, so I resized it to something more manageable (800x550).

We are gonna use Depth Map Automatic Generator 7 (DMAG7) and Edge Preserving Smoothing 9 (EPS9) to get the depth map, hopefully a decent one.

First thing first, we need to get the minimum and maximum disparities. Instead of using Disparity Finder 2 (DF2), we are gonna use Epipolar Rectification 9 (ER9). When you run the epipolar rectifier, you get some precious info resulting from the good stereo matches found by SIFT and ORSA, in particular, the minimum and maximum disparity. It looks like this for this stereo pair:

Disparity: -153 -10

We however need to take the opposite of what's given by ER9, that is, min_disparity used by DMAG7 = -max_disparity given by ER9 and max_disparity used by DMAG7 = -min_disparity given by ER9. So, in this particular case, min_disparity used by DMAG7 = 10 and max_disparity used by DMAG7 = 153.

This below is the "dmag7_input.txt" I have used:

im0_800.png
im1_800.png
10
153
16
16
7
0.1
1000
10000
8
disp.png

The important parameters are sigma_space (set at 16 here), sigma_color (set at 16 here), and the radius (set at 7 here). What I did is consider three values for sigma_space (8, 16, and 32), three values for sigma_color (8, 16, and 32), and two values for the radius (7 and 12). The best depth map appeared to be for sigma_space = 16, sigma_color= 16, and radius = 7.

Depth map obtained by DMAG7.

Now, we are gonna use the edge preserving smoother EPS9 to get rid of the outliers.

This below is the "eps9_input.txt" I have used:

im0_800.png
disp.png
9
9.0
204.0
disp_smooth.png

Sigma_color (here, set at 204.0) controls the edge preserving part. The larger sigma_color is, the less edge preserving but the smoother it's gonna look.

Depth map smoothed by EPS9.

Wiggle gif obtained with Wiggle Maker