What's the difference between cv2.imread(img) and cv2.imread(cv2.UMat(img))?

asked 2018-01-13 00:49:43 -0600

MadFrog gravatar image

updated 2018-01-13 00:50:54 -0600

What's the difference between the 2 ways of writing?

I want to use GPU to speed up opencv.

I have installed CUDA.

My test code:

import cv2

print(cv2.ocl.haveOpenCL())#True
cv2.ocl.setUseOpenCL(True)
print(cv2.ocl.useOpenCL())#True
pic1 = r'dog.jpg'
img = cv2.imread(cv2.UMat(pic1))
cv2.imshow('test',img)
cv2.waitKey(0)

Can this speed up?

edit retag flag offensive close merge delete

Comments

"What's the difference between the 2 ways of writing?" -- both are wrong.

please have a look at the python tutorials, and try to understand, how the api works, in general, before asking questions like this

berak gravatar imageberak ( 2018-01-14 05:44:19 -0600 )edit

OK!I just ask how to use acceleration, or what situations can accelerate and which functions can accelerate. For opencv's tutorials, I have learned, and I don't think this is directly related to this problem.

MadFrog gravatar imageMadFrog ( 2018-01-14 05:51:27 -0600 )edit