Wednesday, May 16, 2018

Case Study - How to improve depth map quality with DMAG9b and DMAG4

Another stereo pair from the Peter Simcoe collection. As usual, first thing to do is to rectify the stereo pair using either er9b or er9c. This time I chose er9c.


Left image after rectification.


Right image after rectification.

Output from er9c:
Mean vertical disparity error = 0.362055
Min disp = -17 Max disp = 38
Min disp = -21 Max disp = 43

Time to generate the depth map. I am liking dmag6 more and more even though it is a memory hog and quite a bit slower than dmag5. For the min and max disparities, I will use min disp = -21 and max disp = 43.


Depth map obtained by dmag6.

Input to dmag6:
min disparity for image 1 = -21
max disparity for image 1 = 43
disparity map for image 1 = depthmap_l.png
disparity map for image 2 = depthmap_r.png
occluded pixel map for image 1 = occmap_l.png
occluded pixel map for image 2 = occmap_r.png
alpha = 0.9
truncation (color) = 30
truncation (gradient) = 10
truncation (discontinuity) = 10000
iteration number = 5
level number = 5
data cost weight = 0.5
disparity tolerance = 0
radius to smooth occlusions = 9
sigma_space = 9
sigma_color = 25.5
downsampling factor = 1

Let's improve the depth map by calling on our good friend dmag9b. For sure, dmag9b will sharpen the depth map at the object boundaries.


Depth map obtained by dmag9b.

Input to dmag9b:
sample_rate_spatial = 16
sample_rate_range = 8
lambda = 0.25
hash_table_size = 100000
nbr of iterations (linear solver) = 25
sigma_gm = 1
nbr of iterations (irls) = 32
radius (confidence map) = 12
gamma proximity (confidence map) = 12
gamma color similarity (confidence map) = 12
sigma (confidence map) = 32

I don't like the depth map around the bags in the foreground and I really want the 2 thin straps near the bags to be included in the depth map. So, time to do some manual labor before calling on dmag4.


Sparse/scribbled depth map to be fed to dmag4. White areas are actually transparent.

If, when you start erasing with the eraser tool, you get white instead of the checkerboard pattern, it's because you need to add the alpha channel to the depth map.


Edge image to be fed to dmag4. White areas are actually transparent.

I use the paths tool to generate the edge image. It's easy as pie.


Depth map obtained by dmag4.

Input to dmag4:
beta = 0
maxiter = 5000
scale_nbr = 1
con_level = 1
con_level2 = 1


3d wiggle produced by wigglemaker.