Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This header includes some code that nvcc doesn't understand (some intrinsic, asm part, etc). You can divide your code into two parts (cpp & cu). In cpp file you can use all opencv headers, in cu file you can use "opencv2/core/devmem2d.hpp" - lightweight wrapper for GpuMat

// cu file
__global__ void kernel(DevMem2D_<Type> mat)
{
    ...
}
void gpu_func(DevMem2D_<Type> mat)
{
    kernel<<<...>>>(mat);
}

// cpp file
#include <opencv2/opencv.hpp>
void gpu_func(DevMem2D_<Type> mat);
void func(GpuMat mat)
{
   mat.create(...);
   gpu_func(mat);
}

gpu module works in such a way.