OpenCV TypeError: Expected cv::UMat for argument 'src' - What is this? OpenCV TypeError: Expected cv::UMat for argument 'src' - What is this? python python

OpenCV TypeError: Expected cv::UMat for argument 'src' - What is this?


src is the first argument to cv2.cvtColor.

The error you are getting is because it is not the right form. cv2.Umat() is functionally equivalent to np.float32(), so your last line of code should read:

gray = cv2.cvtColor(np.float32(imgUMat), cv2.COLOR_RGB2GRAY)


gray = cv2.cvtColor(cv2.UMat(imgUMat), cv2.COLOR_RGB2GRAY)

UMat is a part of the Transparent API (TAPI) than help to write one code for the CPU and OpenCL implementations.


The following can be used from numpy:

import numpy as np image = np.array(image)