Forum

Author Topic: Estimate image quality  (Read 8118 times)

SAV

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
Estimate image quality
« on: June 11, 2014, 12:21:19 PM »
How can I delete/disable pictures which are below a certain estimated image quality value (e.g. 0.7) using python?

Thanks for the help!!

Cheers
SAV


« Last Edit: June 12, 2014, 09:17:52 AM by SAV »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Estimate image quality
« Reply #1 on: June 17, 2014, 12:05:50 PM »
Hello SAV,

For the quality estimation you should use the following method applied to the chunk instance:
Code: [Select]
chunk.estimateImageQuality()
Then to access the quality value you need to do the following:
Code: [Select]
camera = chunk.cameras[0]
quality = camera.frames[0].meta["Image/Quality"]
if quality < threshold:
        camera.enabled = False

p
Best regards,
Alexey Pasumansky,
Agisoft LLC

SAV

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
Re: Estimate image quality
« Reply #2 on: June 18, 2014, 04:19:34 AM »
Hi Alexy,

Thank you very much.

I already used...
Code: [Select]
chunk.estimateImageQuality()... which worked fine to calculate the IQ ( ;)) for ALL the pictures.

But I did not know how to access/read the "Image Quality" for a single picture.
Thanks for your code.

Great customer service / support  ;D

Cheers
SAV

« Last Edit: June 18, 2014, 05:27:28 PM by SAV »

SAV

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
Re: Estimate image quality
« Reply #3 on: June 18, 2014, 05:33:41 PM »
Hi again Alexy,

I have some strange behaviour of the code - it's not working. It seems like my loop gets stuck at the IF statement.

Code: [Select]
chunk.estimateImageQuality()
for i in range(0, len(chunk.cameras)):
print(i)
camera = chunk.cameras[i]
print(camera)
quality = camera.frames[0].meta["Image/Quality"]
print(quality)
if quality < 0.8:
camera.enabled = False

I deleted the IF statement to see if there was something wrong with the loop itself, but it was working fine. It went through all the photos and disabled them (code below).

Code: [Select]
chunk.estimateImageQuality()
for i in range(0, len(chunk.cameras)):
print(i)
camera = chunk.cameras[i]
print(camera)
quality = camera.frames[0].meta["Image/Quality"]
print(quality)
camera.enabled = False

Do you know what I am doing wrong?

In advance, thanks for your help.

Cheers
SAV

James

  • Hero Member
  • *****
  • Posts: 748
    • View Profile
Re: Estimate image quality
« Reply #4 on: June 18, 2014, 05:59:14 PM »
replace

Code: [Select]
if quality < threshold
with

Code: [Select]
if float(quality) < threshold
the meta thingy returns strings, not numbers!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Estimate image quality
« Reply #5 on: June 18, 2014, 06:44:21 PM »
Sure, James, my fault.
Best regards,
Alexey Pasumansky,
Agisoft LLC

SAV

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
Re: Estimate image quality
« Reply #6 on: June 19, 2014, 04:07:33 AM »
Thank you guys ;D

SAV