opencv-python
opencv-python copied to clipboard
How to convert cv2.Mat() to cv2.UMat()
Hello, I am trying to write some glue code for a third-party library.
In the code, I need to return a data of type cv2.UMat
.
Now I can use cv2.Mat(descs)
to get a Mat
, but I can't find a way to convert cv2.Mat
to cv2.UMat
.
I tried umat = cv.UMat(mat)
, mat.copyTo(umat)
, umat = cv.UMat(descs.shape[0], descs.shape[1], descs.dtype, cv.USAGE_DEFAULT)
, but none of them worked.
I found on the Internet that there seems to be such a method in C to convert Mat
to UMat
, but I can't seem to find it in Python.
Can you give some suggestions?