Forum

Author Topic: Wait for model_view to display the entire point cloud before capture  (Read 1014 times)

picare

  • Newbie
  • *
  • Posts: 32
    • View Profile
Hi,
I want to take a capture of the model_view and of the ortho_view and then export in an image file.

I use the following code:
Code: [Select]
Metashape.app.model_view.view_mode=Metashape.DataSource.DenseCloudData
Metashape.app.model_view.viewpoint.fov=0 #ortho
Metashape.app.model_view.viewpoint.coo=Metashape.Vector([55,38,-15])
Metashape.app.model_view.viewpoint.mag=5
image = Metashape.app.model_view.captureView(width = 640, height = 480, transparent = False, hide_items = False)
image.save(os.path.join(export_path,"PointCloudTop.png"))

Metashape.app.ortho_view.view_mode=Metashape.DataSource.ElevationData
image = Metashape.app.ortho_view.captureView(width = 640, height = 480, transparent = False, hide_items = False)
image.save(os.path.join(export_path,"DEM.png"))

The problem is Metashape has no time to display the pointcloud or elevation data, and so take a capture of the interface with no data except the markers, cameras positions or bounding box.
Using time.sleep(2) for 2 seconds pause, or 10s change nothing because everything is pausing.

Is it any way to wait for the viewport to display the entire point cloud, or any way to pause a script while Metashape does it's displaying functions?
And then, is it a function to change the ortho_view viewpoint?

Thanks!
Pierre