Download opencv

opencv 在 ubuntu中的配置和测试

OpenCV 2.四.九在 Ubuntu 1四.04中的配置和测试

写此文的目标是为了方便大家的读书,小编是搞了半天,通过上网物色资料才成功的。亲测,希望对大家有扶持。作者用的Ubuntu版本为1四.04

1、策动职业
安装GCC:
sudo apt-get install build-essential

安装CMake

sudo apt-get install cmake

安装Git(可选)

sudo apt-get install git

安装GTK开发版

sudo apt-get install libgtk2.0-dev

安装pkg-config

sudo apt-get install pkg-config

安装Python

sudo apt-get install python3.2-dev

安装Numpy

sudo apt-get install python-numpy

安装媒体包:

sudo apt-get install ffmpeg 
//这一个软件包笔者从没设置成功,但是前面测试的时候未有影响。

安装可选媒体包:

sudo apt-get install libavcodec-dev libavformat-devlibswscale-dev
libjpeg-dev libpng-dev libtiff-dev libjasper-dev

  1. 下载并成立OpenCV

自己用的opencv贰.肆.玖,在官互连网下载的缩减双肩包名是opencv-2.肆.玖.zip,能够在官英特网免费下载。

解压opencv-二.四.玖.zip 解压命令:解压前跻身该压缩包所在的目录

unzip opencv-2.4.9

接下来推行以下命令:

cd opencv-2.4.9mkdir release
cd release
cmake -D CMAKE_BUILD_ubuntu中的配置和测试,0肆中的配置和测试。TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local
..
make
sudo make install

 

将文件/etc/ld.so.conf中加多一行代码/usr/local/lib

(在改造进程中有希望出现权力难点,假若出现权力难点输入上面发号施令:

sudo su

用来获得root权限

然后

gedit /etc/ld.so.conf

开始展览编写制定文件)

sudo /sbin/ldconfig -v
下一场是跟退换量
sudo gedit /etc/bash.bashrc也是在最后1行增多
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

在home文件夹下编写1个hello.cpp文件实行测试,包涵#include
<opencv2/core/core.hpp>然后在命令行中输入

g++ `pkg-config –cflags –libs opencv` hello.cpp-o hello进行编写翻译

要是未有报错则opencv配置成功。

 

3.在qt中测试

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;

int main()
{
        namedWindow( “src”);
        Mat img = imread( “/home/gzhao/lena.jpg” );

        if(!img.data) {
            cout<<“file not fount”<<endl;
            return 1;
        }
        else {
            imshow( “src”, img );
            waitKey();
            return 0;
        }
}
然后在×××.pro文件中增加如下配置

INCLUDEPATH += /usr/local/include \
                /usr/local/include/opencv \
                /usr/local/include/opencv2

LIBS += /usr/local/lib/libopencv_highgui.so \
        /usr/local/lib/libopencv_core.so    \
        /usr/local/lib/libopencv_imgproc.so

亟需提前把问家放到home路线下面。

运营结果图:

澳门金沙国际 1

OpenCV官方教程粤语版(For Python) PDF 

Ubuntu Linux下安装OpenCV2.4.1所需包

Ubuntu 12.04 安装 OpenCV2.4.2

CentOS下OpenCV不大概读取摄像文件

Ubuntu 12.04下安装OpenCV 2.4.5总结

Ubuntu 10.04中安装OpenCv2.1九步曲

根据QT和OpenCV的人脸识别系统

[翻译]Ubuntu 14.04, 13.10 下安装 OpenCV
2.4.9 

OpenCV的事无巨细介绍:请点这里
OpenCV的下载地址:请点这里

正文长久更新链接地址:

贰.四.9在 Ubuntu 14.0四中的配置和测试
写此文的目标是为着便利咱们的读书,笔者是搞了半天,通过上网寻觅资料才成功的。亲测,希望对大…

安装要求的依据

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

style=”font-size:18px;”>写此博客的目标是为了方便我们的学习,笔者是搞了半天,通过上网物色资料才成功的。亲测,希望对大家有支持。作者用的bantu版本为1四.0四

一、计划工作
安装GCC:

sudo apt-get install
build-essential

安装CMake

sudo apt-get install cmake

安装Git(可选)

澳门金沙国际,sudo apt-get install git

安装GTK开发版

sudo apt-get install
libgtk2.0-dev

安装pkg-config

sudo apt-get install pkg-config

安装Python

sudo apt-get install
python3.2-dev

安装Numpy

sudo apt-get install python-numpy

安装媒体包:

sudo apt-get install ffmpeg 
//那个软件包作者从未设置成功,但是前面测试的时候未有影响。

安装可选媒体包:

sudo apt-get install libavcodec-dev
libavformat-devlibswscale-dev libjpeg-dev libpng-dev libtiff-dev
libjasper-dev

  1. 下载并创设OpenCV

    style=”font-size:1四px;”>作者用的opencv贰.4.玖,在官英特网下载的压缩马鞍包名是opencv-二.四.九.zip,能够在官英特网无偿下载。

解压opencv-二.四.玖.zip
解压命令:解压前进入该压缩包所在的目录

unzip opencv-2.4.9

然后实践以下命令:

cd opencv-2.4.9mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE
-DCMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install

style=”font-size:14px;”>将文件/etc/ld.so.conf中增多1行代码/usr/local/lib

style=”font-size:14px;”>(在改换进度中有希望出现权力难点,假设出现权力难题输入上边发号施令:

sudo su

用来得到root权限

然后

gedit > style=”font-size:14px;”>/etc/ld.so.conf

张开编写制定文件)

sudo /sbin/ldconfig -v
接下来是跟改换量
sudo gedit /etc/bash.bashrc也是在终极一行加多
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

style=”font-size:1四px;”>在home文件夹下编写三个hello.cpp文件进行测试,包蕴#include
<opencv2/core/core.hpp>然后在命令行中输入

g++ `pkg-config –cflags –libs
opencv` hello.cpp-o hello进行编译

若是未有报错则opencv配置成功。

style=”font-size:18px;”>3.在qt中测试

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;

int main()
{
        namedWindow( "src");
        Mat img = imread( "/home/gzhao/lena.jpg" );

        if(!img.data) {
            cout<<"file not fount"<<endl;
            return 1;
        }
        else {
             imshow( "src", img );
             waitKey();
             return 0;
        }
}

接下来在×××.pro文件中增加如下配置

style=”font-size:18px;”>

INCLUDEPATH += /usr/local/include \
                /usr/local/include/opencv \
                /usr/local/include/opencv2

LIBS += /usr/local/lib/libopencv_highgui.so \
        /usr/local/lib/libopencv_core.so    \
        /usr/local/lib/libopencv_imgproc.so

亟需提前把问家放到home路径上边。

style=”font-size:18px;”>运维结果图:

style=”font-size:14px;”>澳门金沙国际 2

Enter opencv dirctory and install

cd  XXXX/opencv2.4
mkdir Release
cd Release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -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_GTK=ON -D WITH_OPENGL=ON ..

cmake 出错,报错如下

CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:489 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (find_package):
  By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Gui", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Gui" with any
  of the following names:

    Qt5GuiConfig.cmake
    qt5gui-config.cmake

  Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
  "Qt5Gui_DIR" to a directory containing one of the above files.  If "Qt5Gui"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:489 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:20 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:

    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake

  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:489 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:21 (find_package):
  By not providing "FindQt5Test.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Test", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Test" with any
  of the following names:

    Qt5TestConfig.cmake
    qt5test-config.cmake

  Add the installation prefix of "Qt5Test" to CMAKE_PREFIX_PATH or set
  "Qt5Test_DIR" to a directory containing one of the above files.  If
  "Qt5Test" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:489 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:22 (find_package):
  By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5Concurrent", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Concurrent"
  with any of the following names:

    Qt5ConcurrentConfig.cmake
    qt5concurrent-config.cmake

  Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
  "Qt5Concurrent_DIR" to a directory containing one of the above files.  If
  "Qt5Concurrent" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:489 (include)


qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
CMake Error at /usr/share/cmake-3.5/Modules/FindQt4.cmake:1326 (message):
  Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
  cmake/OpenCVFindLibsGUI.cmake:34 (find_package)
  CMakeLists.txt:489 (include)


-- Configuring incomplete, errors occurred!
See also "/home/feng/Documents/opencv-2.4/Release/CMakeFiles/CMakeOutput.log".
See also "/home/feng/Documents/opencv-2.4/Release/CMakeFiles/CMakeError.log".

根据报错音讯,应该是qt没装
安装qt

sudo apt-get install libqt4-dev

cmake成功会变动如下文件

feng@mint ~/Documents/opencv-2.4/Release $ ls
3rdparty  CMakeCache.txt       cmake_uninstall.cmake  CPackSourceConfig.cmake  data     junk      modules             OpenCVConfig-version.cmake  unix-install
apps      CMakeFiles           CMakeVars.txt          CTestTestfile.cmake      doc      lib       opencv2             OpenCVModules.cmake         version_string.tmp
bin       cmake_install.cmake  CPackConfig.cmake      cvconfig.h               include  Makefile  OpenCVConfig.cmake  samples

make
sudo make install

the whole installation tutorial

参报考博士学士客:

相关文章