0

I found example of cuda accelerated opencv python code in official opencv github repository. test_cuda.py

cuMat1 = cv.cuda_GpuMat()
cuMat2 = cv.cuda_GpuMat()
cuMat1.upload(npMat1)
cuMat2.upload(npMat2)

cuMat1 = cv.cuda.cvtColor(cuMat1, cv.COLOR_RGB2GRAY)
cuMat2 = cv.cuda.cvtColor(cuMat2, cv.COLOR_RGB2GRAY)

But I found that module 'cv2.cuda' has no attribute 'cvtColor'.

My opencv build information:

NVIDIA CUDA:                   YES (ver 10.0, CUFFT CUBLAS FAST_MATH)
NVIDIA GPU arch:             61
NVIDIA PTX archs:            61

Full build information

How to fix it?

talonmies
  • 70,661
  • 34
  • 192
  • 269

1 Answers1

-2

You should change like this.

cuMat1 = cv.cuda_GpuMat()
cuMat2 = cv.cuda_GpuMat()

npMat1_n = cv.cvtColor(npMat1, cv.COLOR_RGB2GRAY)
npMat2_n = cv.cvtColor(npMat2, cv.COLOR_RGB2GRAY)

cuMat1.upload(npMat1_n)
cuMat2.upload(npMat2_n)
Arne
  • 1,293
  • 1
  • 7
  • 20