Hello mat,
PhotoScan functionality via Python can be accessed only via PhotoScan itself, i.e. PhotoScan is not provided as external library or module.
In headless mode you can all the script execution via command line call:
photoscan.exe -r script.py
Currently, it is now supported without Photoscan itself.
First, download and pip install Metashape...whl module in anaconda environment:
https://agisoft.freshdesk.com/support/solutions/articles/31000148930-how-to-install-metashape-stand-alone-python-moduleThen, set the folder of Metashape lincense file (metashape.lic) as "agisoft_LICENSE" enviromental variable
e.g. agisoft_LICENSE="D:\\...\\Agisoft\\Metashape Pro\\ "
And then restart computer, and using the following code to check whether the envorment variable be correctly set.
>>> import os
>>> os.environ['agisoft_LICENSE']
'D:\\...\\Agisoft\\Metashape Pro\\'
And then you can call the API directly:
PS C:\Users\xxx> conda activate lab
(lab) PS C:\Users\xxx> python
Python 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import Metashape
>>>
Without giving any license not found error.
And a demo for creating a metashape project:
>>> doc = Metashape.Document()
>>> chunk = doc.addChunk()
>>> path = r"E:\...\PyAPI_Test.psx"
>>> doc.save(path=path)
SaveProject: path = E:/.../PyAPI_Test.psx
saved project in 0.148 sec
LoadProject: path = E:/.../PyAPI_Test.psx
loaded project in 0.021 sec