Saturday, 25 June 2016

My First Depth Maps

This is the first post with details of my first foray into creating a depth map from a stereoscopic image pair from the film Hugo. This is research for use in my dissertation as part of my MA in Film Studies.

Here are the steps I have taken so far:

1. Obtained a digital copy of Hugo 3D. The 3D was in Top and Bottom (TaB) frame format in a Half Over Under (H-OU) resolution of 1920x1090 @ 24fps.

2. Created images of the frames (in PNG format) by using VLC to playback the file with the Scene Video Filter creating an image every 120 frames (i.e. every five seconds). This is an example frame:
TaB frame from Hugo 3D

3. Separated the TaB frames into image pairs using ImageMagick's convert tool:

convert *.png -crop 1856x536+16+8 +repage -set filename:f "%t_r" imagepairs\%[filename:f].png
convert *.png -crop 1856x536+16+544 +repage -set filename:f "%t_l" imagepairs\%[filename:f].png
4. Created a depth map from the image pairs using Depth Map Automatic Generator (DMAG). The example has a depth bracket from -6.8 to +1.2:

DMAG

Depth Map of the same frame

Resized to 192x109 (thereby correcting the aspect ratio)


5. Because an image of 1920x545 creates a depth map with 1,046,400 pixels, the image was resized to 192x109 (i.e. 20,928 pixels) using ImageMagick's convert tool:


convert *.png -resize 192x109! -set filename:f "%t" resized\%[filename:f].png
Get RGB

6. Converted the depth map into a array of pixel values (in a TXT file) using Imaging Technology Group's Get RGB tool. It created 20,928 rows of data:

scene17041.txt

7. This data was imported into Microsoft Excel (as a CSV file) and embellished with formulae to identify the x and y coordinates and the depth (within the defined depth bracket):

Analysis.xlsx

This data can be pivoted to allow some analysis, such as the average depth, position of foreground objects, window violations, etc. Data analysis is one of the next steps!