Forum

Author Topic: What's the Python equivalent of this GUI command?  (Read 2547 times)

walkingrandomly

  • Newbie
  • *
  • Posts: 3
    • View Profile
What's the Python equivalent of this GUI command?
« on: February 06, 2017, 09:47:02 PM »
Hi

I'm a new user of Agisoft and am helping someone migrate from a manual workflow to an automated one.

I have a chunk with a set of photos loaded into it. I click on Workflow->align photos and it thinks for a while before showing me a sparse looking point cloud and there are a set of 'Tie Points' within the chunk.

Could you please tell me what set of Python API operations correspond to this GUI command please?

Best Wishes,
Mike

walkingrandomly

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: What's the Python equivalent of this GUI command?
« Reply #1 on: February 06, 2017, 11:42:04 PM »
The following seems to give similar results. Is it missing anything?

Code: [Select]
import PhotoScan
import os

# File containing all photos
input_directory = './'

# Add a new chunk to the current document
chunk = PhotoScan.app.document.addChunk()


# Add all photos in input_directory to current chunk
photo_files = [file.path for file in os.scandir(input_directory) if file.path.endswith('.jpg')]
chunk.addPhotos(photo_files)

# Align cameras
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, preselection=PhotoScan.GenericPreselection)
chunk.alignCameras()

walkingrandomly

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: What's the Python equivalent of this GUI command?
« Reply #2 on: February 07, 2017, 10:53:05 AM »
I note that every time I run the above script on my set of photos, I get differing numbers of Tie Points.

I start Agisoft, run the above script and get 35841 Tie points.
I restart Agisoft, run the above script again and get 35986 Tie Points

Is something within this script using random numbers? If so, how do I set the random number seed to ensure I get the same tie points from run to run please?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: What's the Python equivalent of this GUI command?
« Reply #3 on: February 07, 2017, 11:01:08 AM »
Hello walkingrandomly,

Photo alignment process is using stochastic element, so the number of tie points may slightly vary for each run.
Best regards,
Alexey Pasumansky,
Agisoft LLC