How would I find the mode (stats) of pixel values of an image?
问题 I'm using opencv and I'm able to get a pixel of an image-- a 3-dimensional tuple, via the code below. However, I'm not quite sure how to calculate the mode of the pixels values in the image. import cv2 import numpy as np import matplotlib.pyplot as plt import numpy as np import cv2 img =cv2.imread('C:\\Users\Moondra\ABEO.png') #px = img[100,100] #gets pixel value #print (px) I tried, from scipy import stats stats.mode(img)[0] But this returns an array shape of stats.mode(img)[0].shape (1, 800