Hi, I have a RGBA image which I need to convert to Grayscale and then to binary with a threshold to get binary histogram but I have 2D Grayscale image in my code which I don't understand how to convert to binary.
# Import libraries from PIL import Image import matplotlib.pyplot as plt import numpy as np import cv2 # Reading an Image image = Image.open('Board1_1.png') # Properties of an Image print(image.size) print(image.format) print(image.mode) # Grayscale conversion image_gray = image.convert('LA') image_gray_array = 255 - np.asarray(image_gray) image_gray_array_1 = image_gray_array[:,:,0] image_gray_array_2 = image_gray_array[:,:,1] image_gray.show()