The image is not in valid type. Use np.float32(image) instead of just image. Example: gray = cv2.cvtColor(np.float32(imgUMat), cv2.COLOR_RGB2GRAY)