ubuntu OPENCV移植
Installing
OpenCV 2.4.1 in Ubuntu 12.04 LTS
The latest Long Term Support version of Ubuntu(12.04 LTS) is out and a new version of OpenCV was released as well. This means that now is a great opportunity to update my OpenCV installation guide to the latest versions, Ubuntu 12.04 LTS and OpenCV 2.4.1.
We are going to setup OpenCV to use the new Qt highgui interface, which is much better than the simple highgui interface. Also, we will install OpenCV with support for OpenGL, as well as reading and writing videos, access to a webcam, Python, C and C++ interfaces,
and Intel Threading Building Blocks (TBB).
OK, so the first step is to make sure that everything in the system is updated and upgraded:
1 |
sudo apt-get |
2 |
sudo apt-get |
apt-get install quota
Now, you need to install many dependencies, such as support for reading and writing image files, drawing on the screen, some needed tools, etc… This step is very easy, you only need to write the following command in the Terminal:
1 |
sudo apt-get install build-essential |
Time to get the OpenCV 2.4.1 source code:
1 |
cd ~ |
3 |
tar -xvf tar .bz2 |
4 |
cd OpenCV-2.4.1 |
Now we have to generate the Makefile by using cmake. In here we can define which parts of OpenCV we want to compile. Since we want to use Python, TBB, OpenGL, Qt, work with videos, etc, here is where we need to set that. Just execute the following line at the
terminal to create the appropriate Makefile. Note that there are two dots at the end of the line, it is an argument for the cmake program and it means the parent directory (because we are inside the build directory, and we want to refer to the OpenCV directory,
which is its parent).
1 |
mkdir build |
2 |
cd build |
3 |
cmake |
Check that the above command produces no error and that in particular it reports FFMPEG as YES. If this is not the case you will not be able to read or write videos. Also, check that Python, TBB, OpenGL, V4L, OpenGL and Qt are detected.
If anything is wrong, go back, correct the errors by maybe installing extra packages and then run cmake again. You should see something similar to this:
Now, you are ready to compile and install OpenCV 2.4.1:
1 |
make |
2 |
sudo make install |
Now you have to configure OpenCV. First, open the opencv.conf file with the following code:
1 |
sudo gedit |
Add the following line at the end of the file(it may be an empty file, that is ok) and then save it:
1 |
/usr/ local /lib |
Run the following code to configure the library:
1 |
sudo ldconfig |
Now you have to open another file:
1 |
sudo gedit bash .bashrc |
Add these two lines at the end of the file and save it:
1 |
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/ local /lib/pkgconfig |
2 |
export PKG_CONFIG_PATH |
Finally, close the console and open a new one, restart the computer or logout and then login again. OpenCV will not work correctly until
you do this.
Now you have OpenCV 2.4.1 installed in your computer with Python, TBB, OpenGL, video, and Qt support.
Check out the cool Qt interface which provides image viewing capabilities with zoom, as well as the ability to save the current image with just one click.
If you zoom in enough, you can see the RGB (or intensity) values for each pixel.
Now let’s build some samples included in OpenCV:
1 |
cd ~/OpenCV-2.4.1/samples/c |
2 |
chmod +x |
3 |
./build_all.sh |
Now we are ready to run the examples:
1 |
./facedetect "/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 |
1 |
./facedetect "/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade= "/usr/local/share/OpenCV/haarcascades/haarcascade_eye.xml" --scale=1.5 |
1 |
~/OpenCV-2.4.1/build/bin/grabcut |
1 |
~/OpenCV-2.4.1/build/bin/calibration_artificial |
1 |
python |
-----------------------------------------------------------------------------------------------人生过隙,忽然而已!
ubuntu OPENCV移植的更多相关文章
- opencv 移植
1.ubunut系统搭建opencv+python开发环境 1.1.ubuntu系统安装pip3工具 sudo apt-get install python3-pip //安装python模块安装工具 ...
- 【opencv】ubuntu opencv imshow()报错
错误提示: ubuntu opencv imshow() 报错 windows.cpp报错 the function is not implemented If you are on Ubuntu o ...
- Ubuntu下移植OpenCv
通过近一周的时候终于成功交叉编译opencv成功了,真心不容易.有一句话乃真理也,凡事贵在坚持.过程总是痛苦的,因为不懂得很多问题但是又需要面对很多问题,最大的收获就是耐心解决所有问题后就懂得这些了. ...
- opencv移植到ubuntu
原创博文,转载请标明出处--周学伟http://www.cnblogs.com/zxouxuewei/ OpenCV 2.2以后版本需要使用Cmake生成makefile文件,因此需要先安装cmake ...
- zedboard OPENCV移植
1:系统环境搭建 要准备好交叉编译环境 见http://blog.csdn.net/xiabodan/article/details/22717175 2:下载cmake CMake是一个跨平台的安装 ...
- opencv移植(二)
原文:https://blog.csdn.net/Guet_Kite/article/details/78667175?utm_source=copy 版权声明:本文为博主原创文章,转载请附上博文链接 ...
- 【转】OpenCV 移植学习--EMCV
在Opencv论坛有好些这方面的帖子,主要看了一下几个牛人的帖子,比如论坛管理员于博士Shiqi Yu:(EMCV:可在DSP上运行的OpenCV)http://www.opencv.org.cn/f ...
- Android平台下OpenCV移植与使用---基于C/C++
在<Android Studio增加NDK代码编译支持--Mac环境>和<Mac平台下Opencv开发环境搭建>两篇文章中,介绍了如何使用NDK环境和Opencv环境搭建与测试 ...
- opencv移植(一)cmake安装
原文:https://blog.csdn.net/Guet_Kite/article/details/78667175?utm_source=copy 版权声明:本文为博主原创文章,转载请附上博文链接 ...
随机推荐
- 创建MS Office 和 WPS 兼容插件
在工作中我们要实现一个功能,需要创建MS Office 和 WPS 兼容插件,也就是创建一个DLL,可以同时兼容office和wps.这样带来的好处就是只需要维护同一份代码,大大降低维护的工作! 1. ...
- oracle日志总结
①. Oracle日志分类: Alert log files--警报日志 , redo log 重做日志(记录数据库的更改,Trace files--跟踪日志(用户和进程) Oracle的重做日志(r ...
- 关于更新到Xcode8的一些问题
随着iOS 10的陆续使用,升级到xcode8也是大势所趋. 虽然现在xcode 8 可能还有一些问题,但是整体还是不错的,对一些常用的插件也做了集成,比如说 ///注释快捷键 下面说一下我遇到的一些 ...
- web前端开发(3)
css 类命名使用骆驼命名法,可以与划线法结合使用. 骆驼命名法用于区别单词,划线命名用于表达从属关系. 尽量不要使用子选择器,否则容易引起冲突隐患. css可以分为 base.common.page ...
- ASP.NET调用word出错
检索COM 类工厂中CLSID 为{000209FF-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 80070005. 开始——控制面板——管理工具—— ...
- POJ 1733 Parity game (并查集)
Parity game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6816 Accepted: 2636 Descr ...
- hdu-5686 Problem B(斐波那契数列)
题目链接: Problem B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- 干掉拖延症!写给新人的GTD方法
部门周会上有一个环节是每个同学讲述本周之最:最认可自己的.最反思的.最困惑的.其中,最认可自己,代表自己阶段性的成就感,在从外界取得成就感之前,首先自己要认可自己.最反思,要注意,不能只反不思,要记录 ...
- Nginx服务器不支持PATH_INFO的问题及解决办法
最近在写一个小程序,然后里面自己写了个URL的处理器,比如说访问index.php/article 那么就会自动加载进来article页面,访问index.php/home就会自动加载home页面. ...
- sql将表中的某个字段进行排序
. update tempTable set field1 = rownum from( select field1, ROW_NUMBER() over(order by fieldId) rown ...