ubuntu编译安装Opencv
来源:互联网 发布:python 支持向量机 编辑:程序博客网 时间:2024/05/21 16:23
直接安装opencv库
sudo apt-get install libopencv-dev
如果需要从源码安装,步骤如下:
Install Dependencies
Essentials
These are libraries and tools required by OpenCV.
sudo apt-get install build-essential checkinstall cmake pkg-config yasm
Image I/O
Libraries for reading and writing various image types. If you do not install then the versions supplied by OpenCV will be used.
sudo apt-get install libtiff4-dev libjpeg-dev libjasper-dev
Video I/O
You need some or all of these packages to add video capturing/encoding/decoding capabilities to the highgui module.
You need some or all of these packages to add video capturing/encoding/decoding capabilities to the highgui module.
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
Python
Packages needed to build the Python wrappers.
Packages needed to build the Python wrappers.
sudo apt-get install python-dev python-numpy
Other third-party libraries
Install Intel TBB to enable parallel code in OpenCV.
Install Intel TBB to enable parallel code in OpenCV.
sudo apt-get install libtbb-dev
GUI
The default back-end for highgui in Linux is GTK. You can optionally install QT instead of GTK and later enable it in the configuration (see next section).
The default back-end for highgui in Linux is GTK. You can optionally install QT instead of GTK and later enable it in the configuration (see next section).
sudo apt-get install libqt4-dev libgtk2.0-dev
Compile and Install
Get a copy of the source code here, extract and create a build directory:tar -xvf OpenCV-2.4.0.tar.bz2cd OpenCV-2.4.0/mkdir buildcd buildConfigure using CMake. You have a lot of options in this step. This is what I use:
cmake -D WITH_QT=ON -D WITH_XINE=ON -D WITH_OPENGL=ON -D WITH_TBB=ON -D BUILD_EXAMPLES=ON ..Notice, that by adding the -D WITH_QT=ON, the highgui module will use QT instead of GTK. If you want to go with GTK just remove this. For more information on the options, look at the CMakeLists.txt file. When you are happy with the configuration you have, you can start compiling:
makeIf compilation finishes without errors, you can install by saying:
sudo make installFinally, make sure that your programs can link to the OpenCV library in run-time by adding the following line at the end of your /etc/ld.so.conf:
/usr/local/libAnd then configure dynamic linker run-time bindings:
sudo ldconfig
Testing
An easy way to test that the compilation went well is to use the OpenCV test utilities. For example, to test the core module go to OpenCV-2.4.0/build/bin and run:./opencv_test_core
Note that some failures when testing other modules may come from missing image files. To correctly run these tests or samples you should move the corresponding image files from OpenCV-2.4.0/samples to OpenCV-2.4.0/build/bin.
For testing that you can compile your own programs and link against the installed OpenCV libraries I have packaged the face detection sample with all the necessary files and a simple Makefile. Download it here, extract and type:
makeThis should compile and run with a test image, so you should see something like this:
0 0
- ubuntu编译安装Opencv
- Opencv+Ubuntu编译安装
- Ubuntu下编译安装OpenCV
- UBUNTU 下编译安装opencv
- ubuntu opencv 安装编译问题
- OpenCV 2.1 在ubuntu中的编译安装
- Ubuntu 10.10 编译安装OpenCV 2.2
- Ubuntu 全新编译安装 OpenCV 2.3
- UBUNTU 下编译安装opencv 2.3.1
- Ubuntu下OpenCV源码编译安装 转
- UBUNTU 下编译安装opencv 2.3.1
- UBUNTU 下编译安装opencv 2.3.1
- ubuntu 下编译安装opencv 2.3.1
- UBUNTU 下编译安装opencv 2.3.1
- Ubuntu下OpenCV的编译安装
- ubuntu 上opencv的安装编译
- ubuntu 下编译安装cmake、OpenCV
- UBUNTU 下编译安装opencv 2.3.1
- 图形处理小游戏
- Windows下搭建Subversion 服务器
- 点击按钮 显示listview中隐藏的checkbox
- Android【环境变量的设置】
- Java跨平台将word转为pdf(结合Jodconverter 和OpenOffice.org)
- ubuntu编译安装Opencv
- 利用信号量来调度共享资源 生产者-消费者问题
- 网络编程中inet_ntoa的一个典型误用
- openlayers cgi proxy跨域问题总结
- sed复制剪切功能与awk
- Android排错:has leaked window com.android.internal.policy.impl.PhoneWindow$ that was originally added
- 微信红包实现原理
- 安装 brew
- activiti表单设置节点的默认变量