linux下opencv下载和编译

原文地址:http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation


获取最新稳定版本的openCV

从Git仓库获取最新的openCV

启动Git客户端并且克隆openCV仓库

在linux下,可以在终端中运行如下的命令来获取:

cd ~/<my_working _directory>
git clone https://github.com/Itseez/opencv.git

在命令行下,使用cmake工具来编译openCV源码

  • 创建一个临时文件夹,用作<camke_binary_dir>,该文件将会存放生成的make文件,工程文件,对象文件以及输出的二进制文件。
  • 进入<camke_binary_dir>并输入:
cmake [<some optional parameters>] <path to the OpenCV source directory> 

示例

cd ~/opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

译者注:不要忘了最后面的..,表示源文件目录为上一层目录

  • 进入创建的临时文件夹,即<camke_binary_dir>,继续输入如下命令进行安装:
make
sudo make install


原文如下:

Getting the Latest Stable OpenCV Version

Getting the Cutting-edge OpenCV from the Git Repository

Launch Git client and clone OpenCV repository

In Linux it can be achieved with the following command in Terminal:

cd ~/<my_working _directory>
git clone https://github.com/Itseez/opencv.git

Building OpenCV from Source Using CMake, Using the Command Line

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

  2. Enter the <cmake_binary_dir> and type

    cmake [<some optional parameters>] <path to the OpenCV source directory>
    

    For example

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

    make
    sudo make install
    
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值