Forum

What's the Python equivalent of this GUI command?

Started by walkingrandomly, February 06, 2017, 09:47:02 PM

Previous topic - Next topic

walkingrandomly

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

The following seems to give similar results. Is it missing anything?


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

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

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