Skip to content

Instantly share code, notes, and snippets.

@atinfinity
Created September 24, 2018 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atinfinity/b2f89e33e398559c5fcefda3ad3c0269 to your computer and use it in GitHub Desktop.
Save atinfinity/b2f89e33e398559c5fcefda3ad3c0269 to your computer and use it in GitHub Desktop.
Python bindingからGpuMatを使うサンプルコード(OpenCV 4.0以上)
import cv2
img = cv2.imread('lena.jpg', cv2.IMREAD_COLOR)
d_img = cv2.cuda_GpuMat()
d_img.upload(img)
d_gray = cv2.cuda.cvtColor(d_img, cv2.COLOR_BGR2GRAY)
gray = d_gray.download()
cv2.imshow('img', img)
cv2.imshow('gray', gray)
cv2.waitKey(0)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment