Tag Archives: Problem and solution

opencv cvtColor dtype issue(error: (-215) )

opencv cvtColor dtype issue(error: (-215) )

Cvb0

more detailed error information is as follows, color.cpp:9710: error: (-215) depth == CV_8U || depth == CV_16U || depth == CV_32F in function CV ::cvtColor;

error is caused by the simple fact that the input image data type (pixel value) of the color space to be converted is not uint8 (0-255, integer value in the interval), but other type,

cv2.cvtColor(X, cv2.COLOR_RGB2HSV) ⇒ cv2.cvtColor(X.astype(np.uint8), cv2.COLOR_RGB2HSV)