opencv 3.2.0

Opencv installation

1.Download 

  https://github.com/opencv/opencv/releases

  https://github.com/opencv/opencv_contrib/releases/tag/3.2.0

  https://github.com/opencv/opencv_extra/releases/tag/3.2.0


2.Reference tools installation :

      2.1 Protobuf installation

a)Download from https://github.com/google/protobuf           I choose 3.1.2

b)Use c++ compile, read  src/README.md

c)sudo apt-get install autoconf automake libtool curl make g++ unzip

d)build:

./autogen.sh

./configure./configure
make
make check
sudo make install
sudo ldconfig

e) To verify  protobuffer version : protoc --version


注意tensorflow

2.2 Caffe installation

http://caffe.berkeleyvision.org/install_apt.html

sudo apt-get install  libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev 
sudo apt-get install --no-install-recommends libboost-all-dev

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

#libprotobuf-dev 
#protobuf-compiler老是遇到 error This file was generated by a newer version of protoc , 发现是版本过多:dpkg --list |grep protobuf,卸载对应的

CUDA: Install by apt-get or the NVIDIA.run package.The NVIDIA package tends to follow more recent library and driver versions, but the installation is more manual.If installing from packages, install the library and latest driver separately; the driver bundled with the library is usually out-of-date.This can be skipped for CPU-only installation.

BLAS: install ATLAS by

sudo apt-get install libatlas-base-dev

             or install OpenBLAS by :sudo apt-get install libopenblas-dev or MKL for better CPU performance.

                              OpenBlas,可以通过下载,然后make, make install

Python (optional): if you use the default Python you will need to

sudo apt-get install the python-dev package to have the Python headers for building the pycaffe interface.


gotoblas


Download from: https://github.com/BVLC/caffe.git

cp Makefile.config.example Makefile.config
# Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN is desired)
make all
make test
make runtest

python;import caffe 说明安装成功

===make pycaffe出现错误

    python/caffe/_caffe.cpp:10:31: fatal error: numpy/arrayobject.h: no such file or directory
    Makefile:498: recipe for target 'python/caffe/_caffe.so' failed make: *** [python/caffe/_caffe.so] Error 1
==fix:

  原因
    python-numpy没有安装到位
    解决方法
    输入命令
    sudo apt-get install python-numpy
    确认Makefile.config文件中有以下代码,注意路径或版本号与自己的相符。
    PYTHON_INCLUDE := /usr/include/python2.7 \

    /usr/lib/python2.7/dist-packages/numpy/core/include



Download Mnist data :   data/mnist$ ./get_mnist.sh

.build_release/tools/caffe             ==>add to env
# train LeNet
caffe train -solver examples/mnist/lenet_solver.prototxt
# train on GPU 2
caffe train -solver examples/mnist/lenet_solver.prototxt -gpu 2
# resume training from the half-way point snapshot
caffe train -solver examples/mnist/lenet_solver.prototxt -snapshot examples/mnist/lenet_iter_5000.solverstate


  • For CPU & GPU accelerated Caffe, no changes are needed.
  • For cuDNN acceleration using NVIDIA’s proprietary cuDNN software, uncomment theUSE_CUDNN := 1 switch inMakefile.config. cuDNN is sometimes but not always faster than Caffe’s GPU acceleration.
  • For CPU-only Caffe, uncomment CPU_ONLY := 1 inMakefile.config.

To compile the Python and MATLAB wrappers do make pycaffe and make matcaffe respectively.Be sure to set your MATLAB and Python paths inMakefile.config first!




2.3 CUDA installation

a)CUDA: https://developer.nvidia.com/cuda-downloads

   I choose 8.0

  1. `sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb`
  2. `sudo apt-get update`
  3. `sudo apt-get install cuda`
  4. cuBLAS Patch Update to CUDA 8: Includes performance enhancements and bug-fixes


b)CUDNN:https://developer.nvidia.com/rdp/cudnn-download 

     I choose 5.1

    tar xvzf cudnn-8.0-linux-x64-v5.1-ga.tgz
    sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include
    sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
    sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*


对于NVIDIA1080P或者Titanx,有可能会遇到重启之后X启动不了的情况,也就是停留在循环登录界面。试过了大黄蜂,更换X,以及各种其他手段都无果,我选择了workround . 也就是以下命令:

prime-select * 去选择备用显卡

nvidia-smi 去确认cuda work



===1080 just use cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64-deb will work fine====

2.4 Other tools

sudo apt-get install git-core  cmake
sudo apt-getinstall cmakebuild-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev

sudo apt-get install libavresample-dev libgphoto2-dev

sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev


Blas,cblas,lapack:

http://www.netlib.org/blas/blas.tgz

http://www.netlib.org/blas/blast-forum/cblas.tgz

http://www.netlib.org/lapack/lapack-3.4.2.tgz


lacpack:

  1. make # 编译所有的lapack文件  
  2. cd lapacke # 进入lapacke 文件夹,这个文件夹包含lapack的C语言接口文件  
  3. make # 编译lapacke  
  4. cp include/*.h /usr/local/include #将lapacke的头文件复制到系统头文件目录  
  5. cd .. #返回到 lapack-3.4.2 目录  
  6. cp *.a /usr/local/lib # 将生成的所有库文件复制到系统库目录 

SS-QT5:

sudo add-apt-repository ppa:hzwhuang/ss-qt5
sudo apt-get update
sudo apt-get install shadowsocks-qt5


vtk

地址:http://www.vtk.org/VTK/resources/software.html         wiki:http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Sphere
或者直接apt-get install libvtk**-qt4 libvtk** libvtk**-dev

如果vtk不安装的话,viz不会被编译,而且cnn_3dobj需要viz

opengl

apt-get install mesa-common-dev libgl1-mesa-dev  sudo apt-get install mesa-common-dev mesademos libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev
QT

https://www.qt.io/download-open-source/  http://blog.youkuaiyun.com/laizhenghong2012/article/details/51758164

numpy

sudo apt-get install python3-numpy 

2.5 Build opencv

mkdir build

cd build

cmake ..           #cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=./  ..

make  -j8

sudo make install

检查:
        cd lib/
        ls
        查看是否存在cv2.so
        存在则:ln cv2.so /usr/local/lib/python2.7/site-packages
        否则重新安装,查找错误
        8.最后检查:
        cd
        python
        import cv2
        如果不报错 则成功!!!!


==MEET PROBLEM==:


      -- Caffe:   NO (FindCaffe.cmake)  message("Caffe_INCLUDE_DIR = \"${Caffe_INCLUDE_DIR}\"")
                                                                message("Caffe_LIBS = \"${Caffe_LIBS}\"")

                                                                Caffe_INCLUDE_DIR = "/usr/local/include"
                                                                Caffe_LIBS = "Caffe_LIBS-NOTFOUND"

==Fix Method==:

:+//Path to bashrc.
+Caffe_INCLUDE_DIR:PATH=/usr/local/include
+//Path to a library.
+Caffe_LIBS:FILEPATH=/usr/local/lib/libcaffe.so

/usr/local/lib$                           sudo cp -r    /localrepo/caffe/src/caffe/                                  ./

/usr/local/include$                sudo cp -r      /localrepo/caffe/include/caffe/                          ./
/usr/local/include/caffe$        sudo cp -r    /localrepo/caffe/build/src/caffe/proto/              ./
#/usr/local/include/caffe/$        sudo cp      /localrepo/caffe/include/caffe/util/io.hpp       ./
/usr/local/include/caffe/$        sudo cp -r   /localrepo/caffe/include/caffe/util/                   ./

/usr/local/lib/$                            sudo cp /localrepo/caffe/.build_release/lib/libcaffe.so  ./



2.6 Hosts

git clone https://github.com/betsyweilin/hosts

开host文件

      sudo  cp /etc/hosts /etc/hosts_bak

      sudo  cp hosts /etc/hosts

      vim gedit /etc/hosts
      添加你需要的项,格式如下:
      格式:
       <IP> <HOSTNAME>.<DOMAIN> <ALIAS>
       示例:
                216.239.37.99 www.google.com
                编辑后,你需要重新启动一下你的网络。
                 /etc/init.d/networking restart



  opengl
<think>好的,我现在需要帮助用户查找关于OpenCV 3.2.0的下载链接和使用文档。首先,根据用户提供的引用内容,用户可能是在Ubuntu或Windows环境下安装和使用OpenCV 3.2.0,尤其是涉及到与darknet_ros的兼容问题以及SIFT/SURF算子的配置。 首先,我需要确认OpenCV 3.2.0的官方下载渠道。OpenCV的官方网站通常提供各个版本的源码包,但用户提到的引用中有提到从Samba共享目录复制文件,这可能是指用户内部的文件共享,但公开的下载链接应该来自官方或可靠的镜像。 查看引用[1],用户提到将opencv-3.2.0.tar.gz和opencv_contrib-3.2.0.tar.gz复制到项目目录并解压。这两个文件通常可以在OpenCV的GitHub仓库的发布页面找到。因此,正确的下载链接应该是GitHub上的发布页面,或者官方的SourceForge链接。 接着,用户可能需要使用文档或安装指南。由于OpenCV 3.2.0是一个较旧的版本,官方文档可能已经更新到新版本,但旧版本的文档通常仍然存在。需要确认是否有对应的文档存档。 另外,引用[3]提到在Windows环境下配置SIFT/SURF算子需要opencv_contrib模块,因此用户可能需要如何正确配置contrib模块的说明。引用[4]提到Ubuntu 20.04安装时遇到的兼容问题,说明安装过程中可能会有依赖项或配置错误需要处理,比如缺少必要的库或CMake参数设置不正确。 用户可能遇到的问题包括:如何下载正确的版本,如何配置contrib模块,如何处理依赖项错误,如何在特定环境下(如Ubuntu或Windows)编译安装,以及如何使用SIFT/SURF等特征检测算法。 需要确保提供的下载链接是可靠的,并且步骤清晰,尤其是针对不同操作系统的安装指南。同时,要提醒用户注意版本兼容性,如darknet_ros可能需要特定版本的OpenCV,因此在安装前应确认其他依赖项的版本要求。 最后,生成的相关问题应涵盖安装步骤、常见错误解决、功能使用(如SIFT)以及版本兼容性等方面,以帮助用户全面了解OpenCV 3.2.0的使用。</think>### OpenCV 3.2.0 下载及使用文档指南 #### 1. 下载链接 - **官方源码下载**: - OpenCV 3.2.0 主仓库: [GitHub Release 页面](https://github.com/opencv/opencv/releases/tag/3.2.0) 或 [SourceForge 存档](https://sourceforge.net/projects/opencvlibrary/files/3.2.0/) 文件名为 `opencv-3.2.0.tar.gz`。 - OpenCV Contrib 模块(包含 SIFT/SURF 等扩展功能): [GitHub Contrib 仓库](https://github.com/opencv/opencv_contrib/releases/tag/3.2.0) 文件名为 `opencv_contrib-3.2.0.tar.gz`[^1][^3]。 #### 2. 安装步骤(以 Ubuntu 为例) **步骤 1:解压源码** ```bash tar -xzf opencv-3.2.0.tar.gz tar -xzf opencv_contrib-3.2.0.tar.gz ``` **步骤 2:配置 CMake** 进入 OpenCV 主目录,创建 `build` 文件夹并配置: ```bash cd opencv-3.2.0 mkdir build && cd build cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0/modules \ -D WITH_CUDA=OFF .. ``` (若需启用 CUDA,需安装对应驱动并设置 `WITH_CUDA=ON`[^2]) **步骤 3:编译与安装** ```bash make -j$(nproc) sudo make install ``` #### 3. 使用文档 - **官方文档**: OpenCV 3.2.0 文档可通过 [官方文档存档](https://docs.opencv.org/3.2.0/) 查看,包含函数说明及示例。 - **SIFT/SURF 使用示例**: 需包含头文件 `#include <opencv2/xfeatures2d.hpp>`,并链接 `opencv_xfeatures2d320` 库(Windows 需添加 `opencv_world320d.lib` 等文件)。 #### 4. 常见问题解决 - **依赖项缺失**: Ubuntu 需安装 `libgtk2.0-dev`、`pkg-config` 等基础库,具体命令: ```bash sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libpng-dev ``` - **版本冲突**: 若与其他库(如 darknet_ros)冲突,建议通过 `sudo updatedb && locate opencv_world` 清理旧版本[^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值