python - Convert an image array to a binarized image with a specific threshehold -


so, extracting pixel values of 3 channels r, g, , b of jpg image, , i'm calculating index using 3 channels. gives me numpy array : indice

here code:

import matplotlib.pyplot plt import numpy np import numpy  image = plt.imread("/home/stagiaire/bureau/image_mais_rgb.jpg")  blue = image[:,:,0] green = image[:,:,1] red= image[:,:,2]  np.errstate(divide='ignore'):     r = red / red + green + blue      g = green / red + green + blue      b = blue / red + green + blue   exgre = 2*g-r-b exred = 1.4*r-b indice = exgre - exred indice_image = indice.astype(numpy.uint8) 

now want convert image array binarized image , choose threshehold near 0 (0.1 or 0.2). how can in python36 ?


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -