Forum

Author Topic: Generate and export only depth maps as greyscale images  (Read 7013 times)

Exorbitart

  • Newbie
  • *
  • Posts: 18
    • View Profile
Generate and export only depth maps as greyscale images
« on: February 11, 2020, 12:05:02 AM »
Hello folks,
is there a way to generate only depthmaps (greyscale 16bit) from my aligned photoset or I have the build everytime a mesh?

My goal is to create displacement maps from my photosets for a texture workflow.... I ask myself if I have to go always the way to generate a highpolymesh and render the depth map later in other 3d tools again, but when I have it already in MS before !?

I work with the standard edition.

Any ideas?
Thanks in advance!
Ben

wojtek

  • Sr. Member
  • ****
  • Posts: 284
    • View Profile
Re: Generate and export only depth maps as greyscale images
« Reply #1 on: February 11, 2020, 11:28:18 AM »
Depth maps in MS are for each photograph (which includes the perspective of every image), to get a proper displacement map out of the whole surface you need to build the mesh.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15219
    • View Profile
Re: Generate and export only depth maps as greyscale images
« Reply #2 on: February 11, 2020, 01:03:15 PM »
Hello Ben,

If you wish to save the depth maps that are stored in the project and no render depth based on the mesh model, you can use Python scripting in Professional edition. Some time ago I think I have posted an example on forum, let me know if you are interested and cannot find it - I'll re-post it here.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Exorbitart

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Generate and export only depth maps as greyscale images
« Reply #3 on: February 12, 2020, 11:29:51 AM »
Hello Ben,

If you wish to save the depth maps that are stored in the project and no render depth based on the mesh model, you can use Python scripting in Professional edition. Some time ago I think I have posted an example on forum, let me know if you are interested and cannot find it - I'll re-post it here.

Hello Alexey,
thanks for you reply and offer. It would be kind if you can post it again. Maybe a reason to change to the pro version.

thanks,
ben

Exorbitart

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Generate and export only depth maps as greyscale images
« Reply #4 on: February 12, 2020, 11:34:10 AM »
Depth maps in MS are for each photograph (which includes the perspective of every image), to get a proper displacement map out of the whole surface you need to build the mesh.

that was my question, it should be possible to get out the whole depthmaps as one stitched map beside normal and ao map it would make the texture building process much easier for us.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15219
    • View Profile
Re: Generate and export only depth maps as greyscale images
« Reply #5 on: February 12, 2020, 02:56:56 PM »
Hello Ben,

Please check attached script. Note that it requires to install numpy module to Metashape Python for correct work.
Best regards,
Alexey Pasumansky,
Agisoft LLC

wojtek

  • Sr. Member
  • ****
  • Posts: 284
    • View Profile
Re: Generate and export only depth maps as greyscale images
« Reply #6 on: February 12, 2020, 03:17:22 PM »
Depth maps in MS are for each photograph (which includes the perspective of every image), to get a proper displacement map out of the whole surface you need to build the mesh.

that was my question, it should be possible to get out the whole depthmaps as one stitched map beside normal and ao map it would make the texture building process much easier for us.

I mean, you sort of should be able to do this, but only if all photographs are perfectly perpendicular to the surface I would think. There's rotation/distortion/perspective you will get from the variability between the individual depth maps.

Speaking out of my A** though as I did not try that myself. Let us know how it works out in practise!

wojtek

  • Sr. Member
  • ****
  • Posts: 284
    • View Profile
Re: Generate and export only depth maps as greyscale images
« Reply #7 on: June 12, 2020, 12:16:21 PM »
Hello Ben,

Please check attached script. Note that it requires to install numpy module to Metashape Python for correct work.

Hey Alexey, I tested this script and it seems to not properly equalize the histogram/normalize the depth range. (it is considerably darker in 8bit output than depth you can render via the GUI). Can you advise?