问题:error: (-210:Unsupported format or combination of formats) in function ‘calcHist’

问题
在这里插入图片描述

OpenCV(4.7.0) /io/opencv/modules/imgproc/src/histogram.cpp:1008: 
error: (-210:Unsupported format or combination of formats)  in function 'calcHist'

场景:

gray = np.arange(4).reshape((2,2))
height, width =  gray.shape
size = gray.size 
hist = cv2.calcHist([gray], [0], None, [256], [0, 256])

解决方案:

gray = np.uint8(np.arange(4).reshape((2,2)))

你可能感兴趣的:(opencv,python)