I want to calculate persentage of black pixels and white pixels for the picture, its colorful one
import numpy as np import matplotlib.pyplot as plt image = cv2
white_pixels = np.logical_and(255==cropped_image[:,:,0],np.logical_and(255==cropped_image[:,:,1],255==cropped_image[:,:,2])) num_white = np.sum(white_pixels)
and the same with 0 for the black ones