python - How can i check in numpy if a binary image is almost all black? -
how can see in if binary image black or white in numpy or scikit-image modules ?
i thought numpy.all
function or numpy.any
not know how neither total black image nor black image.
assuming pixels ones or zeros, might work (not @ tested):
def is_sorta_black(arr, threshold=0.8): tot = np.float(np.sum(arr)) if tot/arr.size > (1-threshold): print "is not black" return false else: print "is kinda black" return true
Comments
Post a Comment