Forum

Author Topic: Python scripting  (Read 1658 times)

AlexShura

  • Newbie
  • *
  • Posts: 1
    • View Profile
Python scripting
« on: April 20, 2018, 10:58:06 AM »
Hi folks!  :)

I am a complete newbie in terms of Scripting, especially with Python. But since I somehow have to find a way in automizing the workflow without the batch process, I want to execute photoscan and this workflow on a virtual computer without screen. I really appreciate any help you can provide me.

To make the story short:

The latest version of PhotoScan is running on my PC with Windows 10 and i want to try in Linux too and I would like the script to run the following for me:

1. Add Photos to the workspace (they all come from a single folder)
2. Aligning the Photos with HIGH Accuracy, GENERIC Pair Preselection & a point limit of 50k.
3. Building a Dense Cloud with HIGH quality and AGGRESSIVE Depth filtering
4. Building a Mesh with ARBITRARY Surface Type, DENSE CLOUD as Source Data as well as a HIGH Polygon Count
5. Build Texture with ADAPTIVE ORTHOPHOTO Mapping Mode, MOSAIC Blending Mode and a Texture Size of 4096 x 1
6. Save the whole project

I know that some people already asked a quite similar question  but unfortunately it didn't work out when I used to modify it for my purpose...

CindyFr

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Python scripting
« Reply #1 on: June 08, 2018, 10:52:37 AM »
Hello AlexShura,

You have http://www.agisoft.com/pdf/photoscan_python_api_1_4_0.pdf.
(This is for the 1.4 version, take care of it)

The importants things are :
Code: [Select]
import PhotoScan #(at the begining of your script)

#and then, in order to open PhotoScan, you call 
app = PhotoScan.Application()
doc = app.document

#To save :
doc.save(#path + project name#)

#add a new chunk :
chunk = doc.addChunk()

#add photos :
chunk.addPhotos(photoList)       # photoList = a tab with strings

etc.. for the rest, you can find it on the doc.

Let us know if you block on another point.