3

我想在ubuntu上运行surfgpu。但是不知道cmakelists怎么写。我已经安装了CUDA 4.2 SDK和Toolkit,C里面的程序可以运行。我的开发环境是Qt.ubuntu 11.10.opencv2.4.2 好用建议表示赞赏。

4

1 回答 1

1

这个怎么样?

# CMakeLists.txt to build OpenCV project
cmake_minimum_required(VERSION 2.8)
project( testOpenCV )

查找 OpenCV 和 CUDA 包

find_package(OpenCV REQUIRED )
find_package(CUDA 4.2 REQUIRED)

从一些目录中包含

# Since surf is a non free package, you also have to add non free include dir
include_directories( ${OpenCV_INCLUDE_DIR} "${OpenCV_SOURCE_DIR}/modules/nonfree/include" ${CUDA_INCLUDE_DIRS})

编译源

cuda_add_executable( exefile source.cpp source2.cpp )
target_link_libraries( exefile ${OpenCV_LIBS} ${otherlibsyouneed} )

以上所有方法仅在您使用以下命令编译 OpenCV 时才有效-DHAVE_CUDA

于 2013-05-17T05:34:08.267 回答