opencv_默认不支持Cuda必须自己重新编译,opecv默认安装运行cuda会出现一下错误
会出现
OpencvError: no GPU support (libraryiscompiled without CUDA support)
再说一次注意opencv版本,可以使用2.4.12及以上版本
用2.4.9大约会在65%时报错
1 下载openCV
2 安装必要的包
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libavcodec-dev libavformat-dev libswscale-dev
3 解压
unzip opencv-2.4.12.zip
4 创建release文件夹
cd opencv-2.4.12
mkdir release
5 编译opencv
cmake-DCMAKE_BUILD_TYPE=RELEASE-DCMAKE_INSTALL_PREFIX=/usr/local-DCUDA_GENERATION=Kepler..
(When using cmake to do configurations, set the option CUDA_GENERATION to specific your GPU architecture. 这使得cuda可以自适应自身的系统)
cd ..
make
sudo make install