I have to count all the values in a matrix (2-d array) that are greater than 200.
The code I wrote down for this is:
za=0
p31 = numpy.asarray(o31)
for i in range(o31.size[0]):
for j in range(o32.size[1]):
if p31[i,j]<200:
za=za+1
print za
o31
is an image and I am converting it into a matrix and then finding the values.
My question is, is there a simpler way to do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…