Thursday, February 6, 2020

An example of 2d to 3d conversion via depth map using the3dconverter2


This is the 2d image for which we want to create a depth map.

Step 1: Create a so-called "edge image" in Gimp.

All you have to do is create a new transparent layer and trace around the objects/persons in the reference image using the pencil tool with a 1 pixel brush (smallest possible). Keeping the "shift" key pressed (will create straight line segments), left-click the mouse button and trace arounbd the objects/persons. If there is a depth discontinuity in the reference image, there should be line segments along the depth discontinuity. Use whatever color you want! I prefer using red. Once you are done, export the layer as "edge_rgba_image.png" and you are done with the "edge image".

Step 2: Create paths to indicate depth clues.

Try to visualize planes parallel to the screen where the depth is constant. For each depth, create a path and name the path "XXX" where XXX is between 000 (furthest or black in the dense depth map) and 255 (closest or white in the dense depth map). If you name the path "XXX" and Gimp changes the name to "XXX #Y" where Y is 1, 2, 3, etc, that's totally fine.

A few tips about the creation of paths:

- Click on the "Polygonal" radio button in the "Tools Options" window so that you only create straight segments.
- Press "Shift" to force the creation of a new path component.
- Press "Ctrl" to enable the closing a path component. You still have to hover over the starting node and left-0click to actually close the path component.
- Press "Ctrl" + Z to remove the last created segment/node.

Once you are done with your paths, right-click on one path and press "Export Path". Make sure to choose "Export all paths from this image" and save as "gimp_paths.svg".

Step 3: Run the3dconverter2 to get the dense depth map.

Use the following input file:

content_image.png
sparse_depthmap_rgba_image.png
dense_depthmap_image.png
gimp_paths.svg
diffusion_direction_rgba_image.png
edge_rgba_image.png

"content_image.png" is your referenc image i.e. the 2d image.
"dense_depthmap_image.png" is the dense depth map to be created by the3dconverter2.
"gimp_paths.svg" contains the paths.
"edge_rgba_image.png" contains the "edge image".

Pay absolutely no attention to:
sparse_depthmap_rgba_image.png
diffusion_direction_rgba_image.png
as you don't need them one bit.

Step 4: Use depthplayer to check if your dense depth map is good enough.

If it is not, adjust the paths and rerun the3dconverter2 until you are satisfied.

For you convenience, I have uploaded the whole Gimp project onto Google Drive so that you can see what the "edge image" and the paths look like: altered_carbon.xcf.


Screen grab of my Gimp project showing the paths I created.


Dense depth map generated by the3dconverter2.

If you rename the dense depth image "content_image_depth.png", you can post it on Facebook as a "Facebook 3D" photo. Pretty cool! By the way, does anybody know how to embed a Facebook 3D photo post onto blogger. I tried the "Embed Post" from Facebook but it doesn't work. Sniff!

Download link for the3dconverter2 (windows 64 bit): the3dconverter2-x64.rar. More info about the3dconverter2: 2d to 3d Image Conversion Software - the3dconverter2. Feel free to visit 3D Software for more free automatic depth map generation software.

Now, I must admit you need to be quite proficient in Gimp to properly use the3dconverter2, in particular, you need to know how to create layers, how to use the Pencil tool, and how to use the Paths tool.

5 comments:

  1. Replies
    1. Hi:
      I have made several posts explaining how to use it. Search for "the3dconverter2" using the search box top-right to find them.
      Cheers, Ugo.

      Delete
  2. creating dense depthmap not working

    ReplyDelete
    Replies
    1. Hi:
      If you send me your .xcf gimp file, I can have a look. If file is large, please use wetransfer (or similar), or share it on google drive.
      Cheers, Ugo.

      Delete