https://www.samontab.com/web/2017/06/installing-opencv-3-2-0-with-contrib-modules-in-ubuntu-16-04-lts/

Installing OpenCV 3.2.0 with contrib modules in Ubuntu 16.04 LTS

OpenCV 3.2.0 has been out for a while and contains many improvements and exciting new features, so it’s time to update this guide using the latest Ubuntu 16.04LTS.

A big change in OpenCV 3.2.0 is that now many of the newest algorithms now reside separately in the contrib repository.

Some of these modules include Face Recognition, RGB-Depth processing, Image Registration, Saliency, Structure From Motion, Tracking, and much more.

So let’s install OpenCV 3.2.0 with the contrib modules and other good stuff by executing the following code on the command line:

01 sudo apt-get update
02 sudo apt-get upgrade
03 sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff5-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen3-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev default-jdk ant libvtk5-qt4-dev
04 cd ~
05 mkdir opencv
06 cd opencv
08 tar -xvzf 3.2.0.tar.gz
10 unzip 3.2.0.zip
11 cd opencv-3.2.0

But before we build it, we need to fix one problem currently present in the contrib modules, specifically in the freetype module, which allows you to draw UTF-8 strings. If you are getting an error similar to ImportError: /usr/local/lib/libopencv_freetype.so.3.2: undefined symbol: hb_shape, this will fix it:

1 sed -i 's/${freetype2_LIBRARIES} ${harfbuzz_LIBRARIES}/${FREETYPE_LIBRARIES} ${HARFBUZZ_LIBRARIES}/g' ../opencv_contrib-3.2.0/modules/freetype/CMakeLists.txt

Since now that problem is solved, now we are ready to build OpenCV.

01 mkdir build
02 cd build
03 cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON .. -DCMAKE_BUILD_TYPE=RELEASE -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0/modules ..
04 make
05 sudo make install
06 echo '/usr/local/lib' | sudo tee --append /etc/ld.so.conf.d/opencv.conf
07 sudo ldconfig
08 echo 'PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig' | sudo tee --append ~/.bashrc
09 echo 'export PKG_CONFIG_PATH' | sudo tee --append ~/.bashrc
10 source ~/.bashrc

Now you should be able to compile with the OpenCV libraries, including the contrib repositories.

For example, let’s compute some Fine-Grained Saliency, which is available in the saliency module of the contrib repository:

1 cd ~
2 mkdir saliency
3 cd saliency
4 cp ../opencv/opencv_contrib-3.2.0/modules/saliency/samples/computeSaliency.cpp .
5 cp ../opencv/opencv-3.2.0/samples/data/Megamind.avi .
6 g++ -o computeSaliency `pkg-config opencv --cflags` computeSaliency.cpp `pkg-config opencv --libs`
7 ./computeSaliency FINE_GRAINED Megamind.avi 23

Original Image:

Computed Saliency:

Posted in Image Processing, Open Source, Programming.

15 comments

By samontab
June 3, 2017

opencv3。4安装出错的更多相关文章

  1. paip.vs2010 或.net 4.0安装出错解决大法.

    paip.vs2010 或.net 4.0安装出错解决大法. 作者Attilax ,  EMAIL:1466519819@qq.com  来源:attilax的专栏 地址:http://blog.cs ...

  2. 关于搭建php电商环境时缺少fileinfo、数据库安装出错问题解决办法

    今天以WSTMart电商系统为例讲解 搭建php电商环境缺少fileinfo.数据库安装出错问题找了很多方法都没能很好解决,该方法简单明了,容易操作 首先需要到开源中国中下载该系统源码,网址为:htt ...

  3. VS 2013 professional版在win10上安装出错的解决方法

    VS 2013 professional版在win10上安装出错的解决方法 win10上安装完VS 2012 professional和VS 2017 professional后,由于项目的需要,要在 ...

  4. centos7下opencv3的安装

    前面说过opencv和python模块的安装,版本是基于opencv 2的,这篇主要说一下opencv3的安装过程以及相关依赖问题的解决,同样opencv3的安装包在官网上可以下载,最新稳定版是3.3 ...

  5. yum 安装出错--"Couldn't resolve host 'mirrors.aliyun.com'"

    1.yum 安装出错 [root@iz25m0z7ik3z ~]#yum install mysql [root@iZ25m0z7ik3Z ~]#yum install mysql Loaded pl ...

  6. ORBSLAM2与OPENCV3.1.0出错解决办法

    用opencv3.1.0做ORBSLAM2运行一下命令时cd ORB_SLAM2 chmod +x build.sh ./build.sh出错:/usr/bin/ld: CMakeFiles/mono ...

  7. opencart在空间中安装出错,连接不上mysql

    客户要求,要在国外某空间安装opencart.话说opencart根本没怎么搞过,也不太清楚,php也是半吊子,临时看了几天,硬着头皮上把. 出错,安装进行到数据库连接设置的时候,死活连接不上,开始以 ...

  8. oneThink安装出错解决

    在Wampserver3.0.0(apache2.4.17+php5.6.15+mysql5.7.9)版本中oneThink安装用1.1github版,不要用1.1开发版,不然安装的时候数据库导入时b ...

  9. Apache+php配置 Mysql安装出错解决办法

    此文包括的注意内容:软件版本及下载地址Apache2.4的配置和安装php7.0的配置mysql5.5的安装常见问题及解决方法1.软件版本Windows server 2008 r2+ 64位Apac ...

随机推荐

  1. 非极大抑制睔PYTHON实现

    非极大抑制(Non-maximum suppression)python代码实现原创Butertfly 发布于2018-11-20 18:48:57 阅读数 293 收藏展开定位一个物体,最后算法就找 ...

  2. phpMydmin的GetShell思路

    phpMyadmin简介 phpMyadmin是一个以PHP为基础的MySQL数据库管理工具,使网站管理员可通过Web接口管理数据库 . 信息收集 此部分主要需要收集的是网站物理路径,否则后续无法通过 ...

  3. 条件判断语句(if-else)

    if-else 语法 if-else 语法,只有一个语句块被执行 if 和 else都是Java中的关键字 if 语法 把 if-else 看做一个表达式,程序整体还是顺序执行的 if (boolea ...

  4. Java 定时循环运行程序

    Timer 和 ScheduledExecutorSeruvce 都能执行定时的循环任务,有函数 scheduleAtFixedRate.但是,如果任务运行时间较长,超过了一个周期时长,下一个任务就会 ...

  5. SSH和SFTP的简单使用

    ssh命令 ssh 命令用来远程登录linux主机:ssh username@hostname 默认端口是22,如果设定了其他端口,那么使用-p参数来指明,例如端口若改为6666, 则登录命令变为 s ...

  6. POJ 1458:Common Subsequence

    Common Subsequence Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 41957   Accepted: 16 ...

  7. mongodb - schema中格式时间

       date:{ type: String,        default: () => moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),   ...

  8. 关于linux 交叉编译器的安装

    找了几个贴 https://www.cnblogs.com/uestc-mm/p/6656325.html 这个最好

  9. 18.swoole学习笔记--案例

    <?php //创建webSocket服务器 $ws=); //open $ws->on('open',function($ws,$request){ echo "新用户 $re ...

  10. 二十六、JavaScript之查找子字符串substring和slice和substr

    一.代码如下 二.效果如下 <!DOCTYPE html> <html> <meta http-equiv="Content-Type" conten ...