opencv-python icon indicating copy to clipboard operation
opencv-python copied to clipboard

How to convert cv2.Mat() to cv2.UMat()

Open JV-X opened this issue 5 months ago • 4 comments

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?

JV-X avatar Sep 19 '24 01:09 JV-X