I wrote an algorithm in Python OpenCV to find certain targets, but sometimes these targets are hard to find so I made this if-else statement to just output 'target not found' when it fails to find the target. I'm iterating over 1000 images and calling the algo on them, but i get this error:
'NoneType' object is not iterable
on 6th line of the code below:
def image_data(img):
img3 = masking (img)
if img3 is None:
print "target not found"
else:
cent, MOI = find_center(img3)
if cent == 0 or MOI == 0:
print 'target not found'
else:
return cent[0],cent[1],MOI
I understand it means it did't find the image, but why doesn't it just go on to the next image and print error statement?
Aucun commentaire:
Enregistrer un commentaire