Download opencv

Download opencv

opencv 在 ubuntu中的配置和测试

OpenCV 2.4.9在 Ubuntu 14.04中的配置和测试

写此文的目的是为着便利我们的读书,小编是搞了半天,通过上网物色资料才成功的。亲测,希望对大家有资助。作者用的Ubuntu版本为14.04

壹 、准备工作
安装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

本人用的opencv2.4.9,在官网上下载的滑坡包包名是opencv-2.4.9.zip,能够在官网上免费下载。

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

unzip opencv-2.4.9

ubuntu中的配置和测试,04中的配置和测试。下一场实施以下命令:

cd opencv-2.4.9mkdir release
cd release
cmake -D CMAKE_BUILD_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也是在最终一行添加
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

在home文件夹下编写三个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的下载地址:请点这里

正文永久更新链接地址:

2.4.9在 Ubuntu 14.04中的配置和测试
写此文的目的是为着便于我们的学习,小编是搞了半天,通过上网查找资料才成功的。亲测,希望对大…

安装要求的依靠

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

安装需求的正视

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版本为14.04

壹 、准备工作
安装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:14px;”>作者用的opencv2.4.9,在官网上下载的缩减包包名是opencv-2.4.9.zip,可以在官网上免费下载。

解压opencv-2.4.9.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中添加一行代码/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:14px;”>在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

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

参照博客:

the whole installation tutorial

参照博客:

相关文章