想用opencv结合gpu加速处理,想重新编译opencv结合cuda模块无奈总出错

在国外网站上搜到一个cmakelists比较靠谱,项目可以生成,但还没有测试程序把list贴出来


############################################################################
# <summary> CMakeLists.txt for OpenCV and CUDA. </summary>
# <date>    2012-02-07          </date>
# <author>  Quan Tran Minh.     </author>
# <email>   quantm@unist.ac.kr  </email>
############################################################################

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(Project_name)

find_package(OpenCV REQUIRED)
find_package(CUDA REQUIRED)
if(CUDA_FOUND)
    set(CUDA_NVCC_FLAGS "-arch;sm_20;-Xptxas;-v")
    # collect source files

    file( GLOB  src *.cpp )
    file( GLOB  hdr *.hpp *.h )
    file( GLOB  cu  *.cu)

    link_libraries(Project_name ${OpenCV_LIBS})
    CUDA_ADD_EXECUTABLE(Project_name ${src} ${hdr} ${img} ${cu})
    CUDA_ADD_CUFFT_TO_TARGET(Project_name)
    CUDA_ADD_CUBLAS_TO_TARGET(Project_name)
else(CUDA_FOUND)
    message("CUDA is not installed on this system.")
endif()


转载于:https://www.cnblogs.com/face2ai/p/9756752.html

Logo

昇腾计算产业是基于昇腾系列(HUAWEI Ascend)处理器和基础软件构建的全栈 AI计算基础设施、行业应用及服务,https://devpress.csdn.net/organization/setting/general/146749包括昇腾系列处理器、系列硬件、CANN、AI计算框架、应用使能、开发工具链、管理运维工具、行业应用及服务等全产业链

更多推荐