So, i am extracting pixel values of the three channels R, G, and B of an JPG image, and then I’m calculating some index using the three channels. Which gives me a numpy array : Indice
Here is my code:
import matplotlib.pyplot as plt import numpy as np import numpy Image = plt.imread("/home/stagiaire/Bureau/image_mais_rgb.JPG") blue = Image[:,:,0] green = Image[:,:,1] red= Image[:,:,2] with 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 I want to convert this image array to binarized image and to choose a threshehold near 0 (0.1 or 0.2). How can I do it in Python36 ?