原文地址:http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
获取最新稳定版本的openCV
- 去到opencv在SourceForge上的主页
- 下载源码包并解压
从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
- Go to our page on Sourceforge;
- Download the source tarball and unpack it.
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
-
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.
-
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 ..
-
Enter the created temporary directory (<cmake_binary_dir>) and proceed with:
make sudo make install