Wednesday, October 7, 2015

2D to 3D Conversion - Dana Andrews and Gene Tierney in Laura

This is the still from the movie "Laura" I started with:

I loaded up the 2d picture in Gimp, created a new layer, and used the pencil tool to indicate levels of depth in that new layer. Tip: no need to be too precise here as the depths don't need to be accurate at all. It's usually a good idea to exaggerate the depths. I also used the color picker tool and the eraser tool. Once I was happy with my brush strokes, I went into layer->transparency->Threshold Alpha and clicked ok (this guarantees that all pixels are either fully opaque or transparent), saved the whole thing and exported (as a png file) the layer after having turned off the 2d image underneath (click on the eye icon in the layer dialog window). I kinda assume that everybody knows how to do this but I am kinda willing to make a video if there's a request for it. In any case, if you're at all interested in making depth maps, I would strongly suggest learning how to use Gimp (or Photoshop) since it can make your life much easier.

This is the brush stroke layer I drew (aka the sparse depth map) on top of the 2d image:

This is the brush stroke layer I drew (aka the sparse depth map) all by itself:

All that was left to do was to feed the 2d image and the sparse depth map to Depth Map Automatic Generator 4 (DMAG4), the premier (according to me) semi-automatic 2d to 3d image converter.

After a little bit of churning by DMAG4, this is the dense depth map I obtained:

I am not too picky so this will do nicely. Of course, one can always modify the sparse depth map in the Gimp and rerun DMAG4 for a better depth map, but I am not sure it's worth doing? I guess it depends on what you intend to do with the depth map.

The final step (for me) was to create a 3d animated gif (aka a wigglegram) given the 2d image and the depth map using Wiggle Maker, the premier tool to create 3d wiggles. Personally, in Wiggle Maker, I like to set the depth of the image plane at about 1,000 and the focal length of the camera at about 10,000. I also did set the reference depth at 255 (white), which means that the animated gif will rotate around a point in the foreground.

Here's the 3d wiggle:

It's always a good idea to check the quality of the depth map by recreating the 3d scene in Depth Map Viewer.

Here's an animated gif showing the reconstructed 3d scene:

Clearly, Dana's hat is not quite right and Gene looks like a flat cardboard prop.

If you have questions, feel free to comment, send me an e-mail, or tweet at me.

If you're on Twitter, follow me and I will follow you:

No comments:

Post a Comment