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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -