ubuntu12中opencv安装,官方

操作之前请确保你的ubuntu系统的源是正确的,可以到http://wiki.ubuntu.org.cn/源列表#Precise.2812.04.29.E7.89.88.E6.9C.AC下察看对应你的版本的源,将/etc/apt/source.list替换为对应的源。执行sudo apt-get update
注意此方法适合opencv2.X
  • 1.安装build-essential:GCC 4.4.x or later. This can be installed with:

    sudo apt-get install build-essential 
  • 安装CMake 
    sudo apt-get install cmake
    
  • 安装一些列的库与组件:       方便操作,命令合并如下
  • sudo apt-get install libgtk2.0-dev pkg-config python-dev  python-numpy libavcodec-dev libavformat-dev libswscale-dev libdc1394-22  libjpeg-dev libpng-dev libtiff-dev libjasper-dev(最后面的四个包是可选的)
    
  • 获得OPENCV源码包

  • Building OpenCV from Source Using CMake, Using the Command Line

    Create a temporary directory, which we denote as , where you want to put the generated Makefiles, project files as well the object files and output binaries.

    Enter the and type

    cmake [] source directory>

  • For example

    cd ~/opencv 
    
    mkdir release 
    
    cd release 
    
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
    
  • Enter the created temporary directory () and proceed with:

    make
    sudo make install
    
  • sudo ldconfig重新加载系统中使用的库,可以不用重启电脑就可用opencv库了
  • 参阅:http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html

你可能感兴趣的:(ubuntu12中opencv安装,官方)