Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: forumname on June 10, 2021, 05:00:54 AM

Title: exportPoints() deletes cloud
Post by: forumname on June 10, 2021, 05:00:54 AM
I have a cloud that I would like to export:

frame.dense_cloud
<DenseCloud '3354 points'>


When I call exportPoints(), it outputs an empty file and then deletes the points from frame.

frame.exportPoints('f0.xyz', binary=False, format=Ms.PointsFormatXYZ)
ExportPoints: binary = off, format = PointsFormatXYZ, path = f0.xyz
point cloud size: 0 points


When I check the dense cloud again, the points are now deleted.

frame.dense_cloud
<DenseCloud '0 points'>


How do I export a cloud?


Title: Re: exportPoints() deletes cloud
Post by: Alexey Pasumansky on June 10, 2021, 02:05:12 PM
Hello forumname,

I am not observing such behavior on random project with the dense point cloud.

Please specify, which Metashape version you are using and whether you observe similar behavior if you try to export point using application GUI?
Title: Re: exportPoints() deletes cloud
Post by: forumname on June 10, 2021, 06:33:28 PM
Version 1.7.2 build 12070 (64 bit) on Linux Ubuntu.

Exporting through GUI is fine.

The above problem was encountered running through Spyder IDE. Running the script from Metashape also deletes the point cloud.


import Metashape as Ms

doc = Ms.Document()

doc.open('./F2.psx')

chunk = doc.chunk


for frame in chunk.frames:
    frame.matchPhotos(downscale=1)

chunk.alignCameras( adaptive_fitting=True )


for frame in chunk.frames:
    frame.buildDepthMaps( downscale = 8, max_neighbors = 5 )

region = chunk.region
region.size = 1.5 * region.size
chunk.region = region


for frame in chunk.frames:
    frame.buildDenseCloud( keep_depth = True,
                          point_confidence = True,
                          max_neighbors = 5 )

    frame.exportPoints('f0.xyz', binary=True, format=Ms.PointsFormatXYZ)

Title: Re: exportPoints() deletes cloud
Post by: Alexey Pasumansky on June 10, 2021, 08:46:23 PM
Hello forumname,

Does it help, if you add the following line to the final loop before the export line:
Code: [Select]
doc.save()
Title: Re: exportPoints() deletes cloud
Post by: forumname on June 11, 2021, 02:21:52 AM
Solved, thank you.