Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: SAV 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
-
Hello SAV,
For the quality estimation you should use the following method applied to the chunk instance:
chunk.estimateImageQuality()
Then to access the quality value you need to do the following:
camera = chunk.cameras[0]
quality = camera.frames[0].meta["Image/Quality"]
if quality < threshold:
camera.enabled = False
p
-
Hi Alexy,
Thank you very much.
I already used...
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
-
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.
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).
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
-
replace
if quality < threshold
with
if float(quality) < threshold
the meta thingy returns strings, not numbers!
-
Sure, James, my fault.
-
Thank you guys ;D
SAV