Ubuntu下安装OpenCV

The installation procedures detailed below have been tested and verified using:

    * Ubuntu 10.04.3 LTS ("fresh" install)
    * OpenCV 2.3.1

1.1 Installing OpenCV

1. Open Terminal: Applications->Accessories->Terminal

2. Download and install CMake and other required dependencies:

$ sudo apt-get update
$ sudo apt-get install build-essential cmake libgtk2.0-dev libtiff4-dev libjasper-dev libavformat-dev libswscale-dev libavcodec-dev libjpeg62-dev

3. Download OpenCV 2.3.1 (choose a folder where you wish to download the file to: e.g. home/Downloads):

$ cd Downloads
$ wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2

4. Unpack archive and navigate to the newly created folder containing the OpenCV source:

$ tar -xvf OpenCV-2.3.1a.tar.bz
$ cd OpenCV-2.3.1/

5. Create a new folder and navigate to it (the build files generated by CMake will go into this folder):

$ mkdir release
$ cd release

6. Use CMake to generate the makefile:

Note: Remember to specify the source folder as the last argument while invokingcmake.

$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON .

7. Compile and install OpenCV:

$ sudo make install

8. Point system to generated libraries (change path if different):

$ export LD_LIBRARY_PATH=~/Downloads/OpenCV-2.3.1/release/lib:$LD_LIBRARY_PATH
$ sudo ldconfig

9. (Optional) Use pkg-config to simplify the "making/building" of your OpenCV projects:

$ pkg-config opencv --libs

OpenCV dependencies can now be linked with simply: `pkg-config opencv --cflags --libs`

10. Restart Ubuntu to complete installation.

11. Test a sample program.

$ cd ../sample/cpp/
$ g++ `pkg-config opencv --libs --cflags` drawing.cpp -o drawing
$ ./drawing


http://code.google.com/p/qt-opencv-multithreaded/wiki/Documentation


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值