Forum

Author Topic: How can I remove Photos based on Image quality with script  (Read 10656 times)

Milderinne

  • Newbie
  • *
  • Posts: 34
    • View Profile
Hello,

I would like to ask if there is any possibility to remove photos based on the calculated image quality with python scripting?
Do I understand it right, that I calculate image quality like this:

Code: [Select]
chunk1.estimateImageQuality()
If not, please tell me how to do it right and how to access these calculated values to disable images which have a poor quality.

Thanks in advance!


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15464
    • View Profile
Re: How can I remove Photos based on Image quality with script
« Reply #1 on: May 11, 2016, 08:14:06 PM »
Hello Milderinne,

Using the following code you can calculate and access the quality value for the first camera in the chunk:

Code: [Select]
camera = chunk.cameras[0]
chunk.estimateImageQuality([camera])
quality = float(camera.photo.meta['Image/Quality'])
Best regards,
Alexey Pasumansky,
Agisoft LLC

Milderinne

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: How can I remove Photos based on Image quality with script
« Reply #2 on: May 11, 2016, 09:07:17 PM »
Hello Alexey,

that was fast.
Thank you.
But how do I know use that image quality to disable certain images lower a specific value?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15464
    • View Profile
Re: How can I remove Photos based on Image quality with script
« Reply #3 on: May 11, 2016, 09:29:10 PM »
Hello Milderinne,

You can use something like the following:
Code: [Select]
threshold = 0.3

if quality < threshold:
    camera.enabled = False
Best regards,
Alexey Pasumansky,
Agisoft LLC

Milderinne

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: How can I remove Photos based on Image quality with script
« Reply #4 on: May 11, 2016, 09:35:47 PM »
Thank you so much! I will try that out tomorrow!

Milderinne

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: How can I remove Photos based on Image quality with script
« Reply #5 on: May 12, 2016, 08:41:17 PM »
Hello Alexey!
It worked perfect  :)

Doing more scripting of course another question just popped out.
How can I print out the maximum reprojection error in my logfile?

Code: [Select]
MaxReprojectErr = ???
outputLog.write('Starting calculate reprojection errorr: %s\n'%time.asctime())
outputLog.write('Max reprojection error for %s = %s\n'%(chunk1.label, MaxReprojectErr))

Would be great if you could help me figure that out!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15464
    • View Profile
Re: How can I remove Photos based on Image quality with script
« Reply #6 on: May 13, 2016, 11:49:14 PM »
Hello Milderinne,

Here I've posted the script that estimates reprojection error for each camera and also the average value:
http://www.agisoft.com/forum/index.php?topic=5255.msg25913#msg25913
Best regards,
Alexey Pasumansky,
Agisoft LLC

Milderinne

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: How can I remove Photos based on Image quality with script
« Reply #7 on: May 14, 2016, 09:01:31 PM »
Hello Alexey,

thank you for forwarding me there. I did not find that before.

Kind Regards!