opencv - How to include and use OpenCv3.1.0 library to CUDA file(.cu)? -
i tried implement own kernel median filter pseudo code:
//main.cpp #include "opencv2/opencv.hpp" cv::mat inputmat = cv::imread() cudamediancaller (inputmat, kernelmat) //medianfilter.h #include "opencv2/opencv.hpp" cudamediancaller (const cv::mat& inputmat, cv::mat& kernelmat); //medianfilter.cu cudamediancaller (const cv::mat& inputmat, cv::mat& kernelmat) { kernelmedianfilter<<< , >>> (uchar3* d_inputmat, uchar* d_kernelmat) } __global__ void kernelmedianfilter (uchar3* d_inputmat, uchar* d_kernelmat) { }
i compile error :
c1083: cannot open include file:'opencv2/opencv.hpp' : no such file or directory
i know .cu file compile nvcc , not compile opencv header filess.
1) how can include opencv3.1.0 library .cu file?
you don't need include opencv in .cu file. need caller api raw pointers , basic data types parameters.
main.cpp
#include "opencv2/opencv.hpp" #include "medianfilter.h" int main() { cv::mat inputmat = cv::imread(); ..... cudamediancaller (d_inputmat, d_kernelmat); ..... return 0; }
medianfilter.h
cudamediancaller (uchar3* d_inputmat, uchar* d_kernelmat);
medianfilter.cu
cudamediancaller (uchar3* d_inputmat, uchar* d_kernelmat) { kernelmedianfilter<<< , >>> (uchar3* d_inputmat, uchar* d_kernelmat) } __global__ void kernelmedianfilter (uchar3* d_inputmat, uchar* _kernelmat) { }
Comments
Post a Comment