Using OpenCL accelerated functions with OpenCV3 in Python

人盡茶涼 提交于 2019-11-30 14:26:05

Information update

For those of you who see this, OpenCL for OpenCV python version has already been impemented

at 6 Oct 2016

More information

For more information, you can take a look at this issue: T-API python support implemented #6078

According to this issue the support for this feature is still lacking currently but is "in progress", I will update when more becomes available.

The Transparent API is supported in OpenCV 3.2 and above. Here is an example code.

import cv2

img = cv2.UMat(cv2.imread("image.jpg", cv2.IMREAD_COLOR))
imgUMat = cv2.UMat(img)
gray = cv2.cvtColor(imgUMat, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (7, 7), 1.5)
gray = cv2.Canny(gray, 0, 50)

cv2.imshow("edges", gray)
cv2.waitKey();

More details can be found at OpenCV Transparent API

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!