编译opencv有关cuda的代码
opencv3.2提供了cuda很好的支持,cuda的opencv接口,让用户想使用opencv那样去使用cuda,不用写cuda代码
一开始编译opencv有关cuda的代码,opencv 里samples文件夹里有cmakelist可以参考,但是试了之后出现一堆错误,于是去找编译cuda cmake脚本
后来发现cmake里已经自带FindCUDA.cmake了,find_package(CUDA)(注意是大写)就能够找到了,而且像平时那样
target_link_libraries(optical_flow ${OpenCV_LIBS})就好了,但是附上一些最近找的cuda编译方法链接
opencv getting started with cuda: http://on-demand.gputechconf.com/gtc/2013/webinar/gtc-express-itseez-opencv-webinar.pdf
cuda opencv link:
http://opencv.org/platforms/cuda.html
http://docs.opencv.org/2.4/modules/gpu/doc/gpu.html
compile cuda code:
https://stackoverflow.com/questions/31881249/cmake-cuda-opencv
cmake_minimum_required(VERSION 2.8) find_package(CUDA REQUIRED) IF(CUDA_FOUND) SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3 -gencode arch=compute_20,code=sm_20) cuda_compile(CudaKernel CudaKernels.cu) cuda_add_library(CudaKernels CudaKernels.cu) add_definitions(-DGPU_OPENCV_ENABLE) ENDIF()
cmake findCUDA:
https://cmake.org/cmake/help/v3.0/module/FindCUDA.html#findcuda
cmake CUDA:
How to let cmake find CUDA
https://stackoverflow.com/questions/19980412/how-to-let-cmake-find-cuda
build CUDA with cmake
https://codeyarns.com/2013/09/13/how-to-build-cuda-programs-using-cmake/