Forum

Author Topic: estimate image quality for all images in all chunks in a workspace?  (Read 3455 times)

wyowill

  • Newbie
  • *
  • Posts: 20
    • View Profile
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

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: estimate image quality for all images in all chunks in a workspace?
« Reply #1 on: December 11, 2017, 01:06:34 PM »
Hello Will:

It should be something like the following:

Code: [Select]
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()


Best regards,
Alexey Pasumansky,
Agisoft LLC

wyowill

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: estimate image quality for all images in all chunks in a workspace?
« Reply #2 on: December 12, 2017, 07:16:05 AM »
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).

Code: [Select]

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