Agisoft Metashape
Agisoft Metashape => Bug Reports => Topic started by: jbak9141 on May 28, 2019, 03:35:09 PM
-
Hi Alexey,
I've run into a strange issue that seems to affect Metashape when running headless that I'm hoping you can help with.
I have a simple Python script that does the following (please ignore any small typos below as I've pulled out the relevant functionality to keep it brief.
chunk = Metashape.app.document.chunk
chunk.crs = Metashape.CoordinateSystem('EPSG::28356')
chunk.updateTransform()
format = Metashape.PointsFormat.PointsFormatLAS
chunk.importPoints(path='/Users/guest/example.las',
format=format,
projection=chunk.crs
)
chunk.updateTransform()
chunk.resetRegion()
Metashape.app.document.save('/Users/guest/test.psx')
When I run this code line by line via the Python console on Mac OS X, the pt cloud imports and is visible in the chunk.
When I run Metashape headless on Linux, I am left with an empty project with nothing in it. The operation otherwise seems to complete extremely quickly without logging any errors.
Metashape is run using the following system call
./metashape.sh -r my_script.py -platform offscreen
Any ideas why this could be happening?
I also noticed that the help documentation around metashape.sh does not seem to make any mention of the "-platform" option on Linux. Is there somewhere we can see the comprehensive list of options that "metashape.sh"?
Thanks,
J
-
Hello jbak9141,
Please try to modify your headless script in the following way and check, if it gives you a proper result:
import Metashape
doc = Metashape.Document()
chunk = doc.addChunk()
chunk.crs = Metashape.CoordinateSystem('EPSG::28356')
#chunk.updateTransform()
p_format = Metashape.PointsFormat.PointsFormatLAS
chunk.importPoints(path='/Users/guest/example.las',
format=p_format,
projection=chunk.crs
)
#chunk.updateTransform()
chunk.resetRegion()
doc.save('/Users/guest/test.psx')
I've also renamed your "format" variable, as format - is usually a reserved word in Python.