Agisoft Metashape

Agisoft Metashape => Bug Reports => Topic started by: andyroo on May 22, 2018, 10:37:35 PM

Title: Depth maps don't export from context menu (1.4.1)
Post by: andyroo on May 22, 2018, 10:37:35 PM
I have the same issue as this post (http://www.agisoft.com/forum/index.php?topic=7866.msg37573#msg37573) in version 1.4.1 (windows 7). When I right-click on a photo or selected photos after creating depth maps (selecting keep depth maps in preferences) nothing happens. There's no additional prompt, no waiting, no nothing. I can see in the project structure that the .exr files exist, but can't access them to export from the application.

[EDIT] I wonder if the problem is that I have the model in local coordinates so there's no absolute depth reference? I can see that depth maps are generated in my active chunk because I changed the photo view to show them. I tried to explore this a little more with some code in the console and got a Null Model error. This was my attempt at exporting via python:

Code: [Select]
doc = PhotoScan.app.document
chunk = doc.chunk
task = PhotoScan.Tasks.ExportDepth()
task.cameras = chunk.cameras
task.export_depth =True
task.export_normals = True
task.export_diffuse = True
path_depth = "E:\depthMaps"
path_diffuse = "E:\diffuse"
path_normals = "E:\\normals"
task.apply(chunk)
2018-05-22 13:45:46 ExportDepth
2018-05-22 13:45:46 Finished processing in 0.001 sec (exit code 0)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-57-a7a9f0f263fc> in <module>()
----> 1 task.apply(chunk)
RuntimeError: Null model
Title: Re: Depth maps don't export from context menu (1.4.1)
Post by: Alexey Pasumansky on May 24, 2018, 07:24:38 PM
Hello Andy,

Can you please check, if Export Depth works in the version 1.4.2 build 6205 properly?

Actually, Export Depth operation is not using depth maps generated during the dense cloud calculation, the depth is estimated as a distance from the camera to the mesh model and would work even for unscaled models.

So to complete this task you need to have mesh model and Null Model error indicates that there's no mesh in the active chunk.
Title: Re: Depth maps don't export from context menu (1.4.1)
Post by: andyroo on May 24, 2018, 08:25:15 PM
That's my problem then, I generated depthmap and pointcloud only. I assumed that since the depth map was visible in the photo pane I could export it.

Title: Re: Depth maps don't export from context menu (1.4.1)
Post by: Alexey Pasumansky on May 24, 2018, 09:03:42 PM
Hello Andy,

you can try to use the following basing on the depth maps:

Code: [Select]
chunk = PhotoScan.app.document.chunk
for camera in chunk.cameras:
    if camera in chunk.depth_maps.keys():
        depth = chunk.depth_maps[camera].image()
        depth.save(camera.label + ".exr")

Let me know if it provides the expected results. But note that the depth image is scaled due to the dense cloud quality value.