How would I take an RGB image in Python and convert it to black OR white? Not grayscale, I want each pixel to be either fully black (0, 0, 0) or fully white (255, 255, 255).
img_rgb = cv2.imread('image.jpg') img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY) (threshi, img_bw) = cv2.threshold(img_gray, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)