Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: wyowill on December 08, 2017, 02:42:09 AM
-
For all chunks in a workspace, I'm looking to:
- estimate image quality for all cameras
- disable cameras with a value < 0.7
- perform a medium alignment
Does anyone have any code to share? I can edit code reasonably well, but still something of a novice when it comes to writing from scratch.
Any help is greatly appreciated.
Cheers!
Will
-
Hello Will:
It should be something like the following:
import PhotoScan
for chunk in PhotoScan.app.document.chunks:
chunk.estimateImageQuality(chunk.cameras)
for camera in chunk.cameras:
if float(camera.photo.meta["Image/Quality"]) < 0.7:
camera.enabled = False
chunk.matchPhotos(accuracy = PhotoScan.MediumAccuracy)
chunk.alignCameras()
-
Cheers Alexey!
Thank-you very much for the jump-start.
I added some variables to your code and used the PS Python Reference manual (1.3.3) for some added user-specified control (below).
import PhotoScan
# environment variables
qual=0.7 # image quality value below which cameras are disabled
keylim=60000 # key point limit for matching
tielim=6000 # tie point limit for matching
# processing loop
for chunk in PhotoScan.app.document.chunks:
chunk.estimateImageQuality(chunk.cameras)
for camera in chunk.cameras:
if float(camera.photo.meta["Image/Quality"]) < qual:
camera.enabled = False
chunk.matchPhotos(accuracy = PhotoScan.MediumAccuracy,keypoint_limit=keylim, tiepoint_limit=tielim)
chunk.alignCameras()
Hopefully someone else will find useful.
Cheers,
Will