Can't compile .cu file when including opencv.hpp
Hi all,
I'm not able to compile .cu files when I add this;
#include <opencv2/opencv.hpp>
Is there any way to make this work?
Hi all,
I'm not able to compile .cu files when I add this;
#include <opencv2/opencv.hpp>
Is there any way to make this work?
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.
Asked: 2012-07-10 01:51:11 -0600
Seen: 3,686 times
Last updated: Jul 04 '16
cv::gpu::remap comparatively slow
Area of a single pixel object in OpenCV
build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04
OpenCV DescriptorMatcher matches
OpenCV for Windows (2.4.1): Cuda-enabled app won't load on non-nVidia systems
Using OpenCV's stitching module, strange error when compositing images
compile error in opencv2/flann/lsh_table.h when compiling bgslibrary
Sharing the error message would be very helpful for others to figure out the problem.
"opencv2/core/devmem2d.hpp"
, This file does not exist in OpenCV3.1.0What's the solution for this question in OpenCV3.1.0?