文章标题

来源:互联网 发布:立领衬衫 知乎 编辑:程序博客网 时间:2024/06/10 01:19

最近这段时间搭建caffe的环境,前前后后花费了10几天的时间.其间,也是遇到各种各种的问题.由于网上朋友们的无私分享,最终我终于完成了搭建.因此,我也决定将我遇到的一些问题和解决办法,共享给大家,也算是一种善意的传递吧. 这篇文章主要是我在ubuntu 下安装opencv过程的一个记录.

  1. 下载安装脚本

  2. 解压后进入目录,Install-OpenCV-master/Ubuntu/2.4/OpenCV, 拷贝出OpenCV-2.4.10.zip. 这里,也可以上网直接下载OpenCV-2.4.10.zip,只是我难得去找其他资源了

  3. 安装

(1) “cd” to the release directory

unzip OpenCV-2.4.10.zip

cd opencv-2.4.10

mkdir release

cd release

(2) configure OpenCV build by running Cmake

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

(3)Compile using GCC from the command line (within the “release” directory) by running “make”:

make

sudo make install

注: 如果make的时候出现错误error nvcc fatal : Unsupported gpu architecture ‘compute_11’,解决办法如下:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D CUDA_GENERATION=Kepler ..

  1. 配置OpenCV路径

(1)输入命令
sudo gedit /etc/ld.so.conf.d/opencv.conf
如果没有此文档,则创建之,并加入
/usr/local/lib
保存后,执行 sudo ldconfig 使修改命令立即生效.
(2)输入命令
sudo gedit /etc/bash.bashrc
加入
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
5. 测试Opencv 安装
cd opencv-2.4.10/samples/c
chmod +x build_all.sh
./build_all.sh

如果出现如下错误

/usr/bin/ld: cannot find -lcufft

/usr/bin/ld: cannot find -lnpps

/usr/bin/ld: cannot find -lnppi

/usr/bin/ld: cannot find -lnppc
/usr/bin/ld: cannot find -lcudart

解决办法参考这里

分别对上面几个文件建立软连接 sudo ln -s /usr/local/cuda-7.5/lib64/libcufft.so.7.5 /usr/lib//libcufft.so

最后,运行
./delaunay
输出:

References:

[1] http://indranilsinharoy.com/2012/11/01/installing-opencv-on-linux/

[2]www.ithao123.cn/content-10406452.html

[3]http://www.douban.com/note/478450231/

[4]http://blog.csdn.net/sysuwuhongpeng/article/details/45485719

0 0