当前位置:   article > 正文

Qt-OpenCV开发环境搭建(史上最详细)_qt opencv

qt opencv

一、环境介绍

系统:Windows10
IDE:Qt 5.13
OpenCV版本:3.4.5


二、OpenCV下载

打开OpenCV官网:http://opencv.org,点击Release下载OpenCV
在这里插入图片描述


三、OpenCV结构介绍

在这里插入图片描述

  • Sources:是当前版本的OpenCV源代码;
  • Windows:Windows环境下编译好的文件(build)+源码;
  • IOS pack:IOS环境下编译好的文件(build)+源码;
  • Android:Android环境下编译好的文件(build)+源码;

在这里插入图片描述
在这里插入图片描述


sources放的是opencv中的cpp文件,相当于一个工厂,build放的是opencv中的h、hpp、lib文件,相当于一个工具。

source里面是各种各样的函数实现,对于只想用opencv的人来说,只关心我怎么用,于是开发者就会使用这些源文件构建出库,这些库里面包含了函数实现。这些库就是各种lib,然后还有头文件。

build里面只有接口,没有cpp中的实现什么的,build是对使用者的,使用者只用知道接口就行了,不需要知道这个是怎么做到的。当然因为opencv开源,所以使用者也可以直接查看源文件。


四、编译OpenCV

1、下载安装Qt和CMake

下载Qt和CMake并安装,版本无特殊要求,在此不做过多介绍;

注意:需要将如下路径加入系统环境变量,添加完后重启生效

//Qt编译器路径
D:\Qt\Qt5.13.2\5.13.2\mingw73_64\bin
D:\Qt\Qt5.13.2\Tools\mingw730_64\bin
  • 1
  • 2
  • 3
//cmake路径
D:\SoftWare\cmake\bin
  • 1
  • 2

2、CMake配置并生成
在这里插入图片描述
路径设置完毕之后,点击Configure:
在这里插入图片描述

在这里插入图片描述
编译器填入如下路径:

C: "D:\Qt\Qt5.13.2\Tools\mingw730_64\bin\gcc.exe"
C++: "D:\Qt\Qt5.13.2\Tools\mingw730_64\bin\g++.exe"
  • 1
  • 2

点击Finish:
在这里插入图片描述
在这里插入图片描述
修改以下几项配置:

NameValue
ENABLEENABLE_CXX11(选中)
WITHWITH_OPENGL(选中)
WITHWITH_QT(选中)
WITHWITH_IPP(不选)
第一次点击Configure:
在这里插入图片描述
修改如下路径:
模块路径
Qt5_DIRD:/Qt/Qt5.13.2/5.13.2/mingw73_64/lib/cmake/Qt5
Qt5Concurrent_DIRD:/Qt/Qt5.13.2/5.13.2/mingw73_64/lib/cmake/Qt5Concurrent
Qt5Core_DIRD:/Qt/Qt5.13.2/5.13.2/mingw73_64/lib/cmake/Qt5Core
Qt5Gui_DIRD:/Qt/Qt5.13.2/5.13.2/mingw73_64/lib/cmake/Qt5Gui
Qt5OpenGL_DIRD:/Qt/Qt5.13.2/5.13.2/mingw73_64/lib/cmake/Qt5OpenGL
Qt5Test_DIRD:/Qt/Qt5.13.2/5.13.2/mingw73_64/lib/cmake/Qt5Test
Qt5widgets_DIRD:/Qt/Qt5.13.2/5.13.2/mingw73_64/lib/cmake/Qt5Widgets

在这里插入图片描述
第二次点击Configure:
在这里插入图片描述
没有红色,说明没有什么大问题了,修改版本为发行版:
在这里插入图片描述
第三次点击Configure:
在这里插入图片描述
Configuring done之后点击Generate:
在这里插入图片描述
生成之后的文件结构如下:
在这里插入图片描述


3、开始编译
在生成文件夹中按下Shift键,点击鼠标右键,选择在此处打开命令行:
在这里插入图片描述
输入如下指令开始编译(-j 8 多核编译):

mingw32-make -j 8
  • 1

在这里插入图片描述
编译完成之后,输入如下指令安装:

mingw32-make install
  • 1

在这里插入图片描述


4、问题汇总

问题一:windres.exe: preprocessing failed.

解决办法:去掉CMake中OPENCV项中的OPENCV_ENABLE_ALLOCATOR_STATS的勾勾

问题二:error: ‘std::_hypot’ has not been declared

解决方法1:此问题是由于pyconfig.h和cmath 冲突所致;
修改OpenCV源码D:\Qt\openCV3.4.12\openCV3.4.12\modules\python\src2\cv2.cpp ,在 #include <pyconfig.h>之前添加#include <math.h>

解决办法2:取消CMake中的配置项:“BUILD_opencv_python3” 和 “BUILD_opencv_python_bindings_generator”

问题三:collect2.exe: error: ld returned 5 exit status
mingw32-make[2]: *** [modules\python3\CMakeFiles\opencv_python3.dir\build.make:104: lib/python3/cv2.cp37-win32.pyd] Error 1
mingw32-make[2]: *** Deleting file ‘lib/python3/cv2.cp37-win32.pyd’
mingw32-make[1]: *** [CMakeFiles\Makefile2:4181: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2

解决办法1:将CMake中的Python2、Python3中的值全部设为空

解决办法2:取消CMake中的配置项:“BUILD_opencv_python3” 和 “BUILD_opencv_python_bindings_generator”

问题四:sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA

解决办法:修改OpenCV源码:D:\Qt\openCV3.4.12\openCV3.4.12\modules\videoio\src\cap_dshow.cpp ,在#include "DShow.h"这行的上面加一行#define NO_DSHOW_STRSAFE

问题五:
在这里插入图片描述
在这里插入图片描述

问题六:cmake中Configure时 ffmpeg.dll 下载一直失败(这会导致编译后的OpenCV无法用VideoCapture打开视频)
在这里插入图片描述

FFMPEG: Download: opencv_videoio_ffmpeg.dll
Try 1 failed

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
  FFMPEG: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  C:/Users/Administrator/Desktop/opencv-4.5.0/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
  modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
  modules/videoio/cmake/init.cmake:3 (include)
  modules/videoio/cmake/init.cmake:22 (add_backend)
  cmake/OpenCVModule.cmake:312 (include)
  cmake/OpenCVModule.cmake:375 (_add_modules_1)
  modules/CMakeLists.txt:7 (ocv_glob_modules)


FFMPEG: Download: opencv_videoio_ffmpeg_64.dll
Try 1 failed

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
  FFMPEG: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  C:/Users/Administrator/Desktop/opencv-4.5.0/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
  modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
  modules/videoio/cmake/init.cmake:3 (include)
  modules/videoio/cmake/init.cmake:22 (add_backend)
  cmake/OpenCVModule.cmake:312 (include)
  cmake/OpenCVModule.cmake:375 (_add_modules_1)
  modules/CMakeLists.txt:7 (ocv_glob_modules)


FFMPEG: Download: ffmpeg_version.cmake
Try 1 failed

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at cmake/OpenCVDownload.cmake:202 (message):
  FFMPEG: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  C:/Users/Administrator/Desktop/opencv-4.5.0/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download)
  modules/videoio/cmake/detect_ffmpeg.cmake:14 (download_win_ffmpeg)
  modules/videoio/cmake/init.cmake:3 (include)
  modules/videoio/cmake/init.cmake:22 (add_backend)
  cmake/OpenCVModule.cmake:312 (include)
  cmake/OpenCVModule.cmake:375 (_add_modules_1)
  modules/CMakeLists.txt:7 (ocv_glob_modules)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82

在这里插入图片描述

解决办法:
1、打开编译生成路径(D:\Qt\opencv-3.4.5\build),找到CMakeDownloadLog.txt,并打开如下所示:

#use_cache "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache"
#match_hash_in_cmake_cache "OCV_DOWNLOAD_ADE_HASH_3rdparty_ade_v0_1_1f_zip"
#do_copy "opencv_videoio_ffmpeg.dll" "37e2dadf776631acc8856e281f29cf42" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/opencv_videoio_ffmpeg.dll" "C:/Users/Administrator/Desktop/opencv-4.5.0/build/3rdparty/ffmpeg"
#missing "C:/Users/Administrator/Desktop/opencv-4.5.0/build/3rdparty/ffmpeg/opencv_videoio_ffmpeg.dll"
#check_md5 "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/37e2dadf776631acc8856e281f29cf42-opencv_videoio_ffmpeg.dll"
#mismatch_md5 "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/37e2dadf776631acc8856e281f29cf42-opencv_videoio_ffmpeg.dll" "d41d8cd98f00b204e9800998ecf8427e"
#delete "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/37e2dadf776631acc8856e281f29cf42-opencv_videoio_ffmpeg.dll"
#cmake_download "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/37e2dadf776631acc8856e281f29cf42-opencv_videoio_ffmpeg.dll" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/opencv_videoio_ffmpeg.dll"
#try 1
# timeout on name lookup is not supported
#   Trying 0.0.0.0...
# TCP_NODELAY set
# connect to 0.0.0.0 port 443 failed: Address not available
# Failed to connect to raw.githubusercontent.com port 443: Address not available
# Closing connection 0
# 

#do_copy "opencv_videoio_ffmpeg_64.dll" "cf5dba83edf8619f57ccff4edb989c62" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/opencv_videoio_ffmpeg_64.dll" "C:/Users/Administrator/Desktop/opencv-4.5.0/build/3rdparty/ffmpeg"
#missing "C:/Users/Administrator/Desktop/opencv-4.5.0/build/3rdparty/ffmpeg/opencv_videoio_ffmpeg_64.dll"
#check_md5 "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/cf5dba83edf8619f57ccff4edb989c62-opencv_videoio_ffmpeg_64.dll"
#mismatch_md5 "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/cf5dba83edf8619f57ccff4edb989c62-opencv_videoio_ffmpeg_64.dll" "d41d8cd98f00b204e9800998ecf8427e"
#delete "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/cf5dba83edf8619f57ccff4edb989c62-opencv_videoio_ffmpeg_64.dll"
#cmake_download "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/cf5dba83edf8619f57ccff4edb989c62-opencv_videoio_ffmpeg_64.dll" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/opencv_videoio_ffmpeg_64.dll"
#try 1
# timeout on name lookup is not supported
#   Trying 0.0.0.0...
# TCP_NODELAY set
# connect to 0.0.0.0 port 443 failed: Address not available
# Failed to connect to raw.githubusercontent.com port 443: Address not available
# Closing connection 0
# 

#do_copy "ffmpeg_version.cmake" "f8e65dbe4a3b4eedc0d2997e07c3f3fd" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/ffmpeg_version.cmake" "C:/Users/Administrator/Desktop/opencv-4.5.0/build/3rdparty/ffmpeg"
#missing "C:/Users/Administrator/Desktop/opencv-4.5.0/build/3rdparty/ffmpeg/ffmpeg_version.cmake"
#check_md5 "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/f8e65dbe4a3b4eedc0d2997e07c3f3fd-ffmpeg_version.cmake"
#mismatch_md5 "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/f8e65dbe4a3b4eedc0d2997e07c3f3fd-ffmpeg_version.cmake" "d41d8cd98f00b204e9800998ecf8427e"
#delete "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/f8e65dbe4a3b4eedc0d2997e07c3f3fd-ffmpeg_version.cmake"
#cmake_download "C:/Users/Administrator/Desktop/opencv-4.5.0/opencv-4.5.0/.cache/ffmpeg/f8e65dbe4a3b4eedc0d2997e07c3f3fd-ffmpeg_version.cmake" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/ffmpeg_version.cmake"
#try 1
# timeout on name lookup is not supported
#   Trying 0.0.0.0...
# TCP_NODELAY set
# connect to 0.0.0.0 port 443 failed: Address not available
# Failed to connect to raw.githubusercontent.com port 443: Address not available
# Closing connection 0
# 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46

详解如下

#do_copy "opencv_videoio_ffmpeg.dll" "37e2dadf776631acc8856e281f29cf42" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/opencv_videoio_ffmpeg.dll" "C:/Users/Administrator/Desktop/opencv-4.5.0/build/3rdparty/ffmpeg"
  • 1
  • “opencv_videoio_ffmpeg.dll”: 需要下载的文件;
  • “37e2dadf776631acc8856e281f29cf42”: 需要下载的文件对于的哈希码;
  • “https://raw.githubusercontent.com/opencv/opencv_3rdparty/6152e132572dfdaa32887eabeb7199bef49b14dc/ffmpeg/opencv_videoio_ffmpeg.dll” : 需要下载的文件的下载地址;
  • “C:/Users/Administrator/Desktop/opencv-4.5.0/build/3rdparty/ffmpeg” : 需要下载的文件下载下来的存放路径

查看CMakeDownloadLog.txt,可知总共有三个文件需要下载,分别是:

  • “opencv_videoio_ffmpeg.dll”
  • “opencv_videoio_ffmpeg_64.dll”
  • “ffmpeg_version.cmake”

科学上网,访问每个文件对应的下载地址将之下载下来,其中前两个文件可以直接下载,第三个文件输入网址后不会直接下载,而是会直接将内容显示出来,之后右键网页另存为,然后修改名字为ffmpeg_version.cmake即可(不可自己创建,然后把内容复制进去,这样哈希码对应不上,不可行)。

文件下载完之后,需要把下载下来的文件放到它应该待的地方去,总共有两处:

  • 源代码下的opencv-4.5.0\.cache\ffmpeg,命名格式:哈希码-文件名;
    在这里插入图片描述

  • 编译输出代码下的opencv-3.4.5\build\3rdparty\ffmpeg,命名格式:与CMakeDownloadLog.txt中的名字一致;
    在这里插入图片描述

文件摆放好之后,再次使用cmake:Configure-Generate,即可

在这里插入图片描述


五、配置Qt工程

编译输出目录下的install文件夹,这个才是我们所需要的,可以将这个文件夹复制到自己想要的位置:
在这里插入图片描述
1、添加环境变量

D:\Qt\openCV3.4.12\openCV3.4.12-build\install\x64\mingw\bin
  • 1

在这里插入图片描述
注意:添加完环境变量记得重启;


2、新建Qt工程并配置

INCLUDEPATH += D:\Qt\openCV3.4.12\openCV3.4.12-build\install\include\
               D:\Qt\openCV3.4.12\openCV3.4.12-build\install\include\opencv2\
               D:\Qt\openCV3.4.12\openCV3.4.12-build\install\include\opencv

LIBS += -L D:\Qt\openCV3.4.12\openCV3.4.12-build\install\x64\mingw\lib\libopencv_*.a

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

在这里插入图片描述


3、测试是否配置正确

#include "mainwindow.h"
#include <QApplication>

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace cv;

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    cv::Mat image = imread("D:\\Qt\\Project\\OpenCV_Test\\1.jpg");
    namedWindow("Display window",WINDOW_AUTOSIZE);
    imshow("Display window",image);
    waitKey(0);
    
    MainWindow w;
    w.show();
    return a.exec();
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

在这里插入图片描述
显示图片成功!!!


#include "mainwindow.h"
#include <QApplication>
#include <QDebug>
#include <QFileDialog>

#include <opencv2/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

using namespace cv;

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    namedWindow("Display", WINDOW_AUTOSIZE);
    VideoCapture cap;
    cap.open("D:/Qt/Project/OpenCV_Test/Resources/test.mp4");
    if(cap.isOpened())
        qDebug()<<"Sucess!";
    else
        qDebug()<<"False!";
    Mat frame;
    for(;;)
    {
        cap >> frame;
        if(frame.empty())
            break;
        imshow("Display", frame);
        if(waitKey(33) >= 0)
            break;
    }

    return a.exec();
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34

在这里插入图片描述
打开视频也成功,如此说明环境配置完完全全成功了!!!


分割线分割线分割线分割线分割线分割线分割线分割线分割线分割线分割线分割线分割线分割线分割线分割线分割线


附、编译opencv-contrib

由于opencv功能越来越臃肿,opencv3改变了项目架构,使用内核+插件的架构形式。在Github中,除了存放正式版OPENCV的主仓库和新增加的opencv_extra仓库外,还添加了一个opencv_contrib的全新仓库,功能有:脸部识别、文本识别、边缘检测、追踪算法等,里面存放的是功能未稳定的代码,如果需要使用这些功能,就需要重新进行编译,opencv的opencv_contrib的版本要一致,否则编译时会出现问题。

一、下载opencv-contrib

opencv-contrib GitHub地址:https://github.com/opencv

在这里插入图片描述
在这里插入图片描述

二、编译opencv-contrib

在cmake Configure和Generate之后,也就是到了下面这步之后,开始编译opencv-contrib
在这里插入图片描述
修改如下两处:

参数value
OPENCV_EXTRA_MODULES_PATHE:\opencv-3.4.5\opencv_contrib-3.4.5\modules
OPENCV_ENABLE_NONFREE勾选上

然后Configure直到没有红色,发现有些文件下载失败,可以参考上面,找到文件CMakeDownloadLog.txt,将文件手动下载下来,并以指定命名格式,放在指定的路径。

xfeatures2d/boostdesc: Download: boostdesc_bgm.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/boostdesc: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:8 (download_boost_descriptors)


xfeatures2d/boostdesc: Download: boostdesc_bgm_bi.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/boostdesc: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:8 (download_boost_descriptors)


xfeatures2d/boostdesc: Download: boostdesc_bgm_hd.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/boostdesc: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:8 (download_boost_descriptors)


xfeatures2d/boostdesc: Download: boostdesc_binboost_064.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/boostdesc: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:8 (download_boost_descriptors)


xfeatures2d/boostdesc: Download: boostdesc_binboost_128.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/boostdesc: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:8 (download_boost_descriptors)


xfeatures2d/boostdesc: Download: boostdesc_binboost_256.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/boostdesc: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:8 (download_boost_descriptors)


xfeatures2d/boostdesc: Download: boostdesc_lbgm.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/boostdesc: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:8 (download_boost_descriptors)


xfeatures2d/vgg: Download: vgg_generated_48.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/vgg: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_vgg.cmake:16 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:9 (download_vgg_descriptors)


xfeatures2d/vgg: Download: vgg_generated_64.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/vgg: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_vgg.cmake:16 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:9 (download_vgg_descriptors)


xfeatures2d/vgg: Download: vgg_generated_80.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/vgg: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_vgg.cmake:16 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:9 (download_vgg_descriptors)


xfeatures2d/vgg: Download: vgg_generated_120.i

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  xfeatures2d/vgg: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/cmake/download_vgg.cmake:16 (ocv_download)
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/CMakeLists.txt:9 (download_vgg_descriptors)


data: Download: face_landmark_model.dat

=======================================================================
  Couldn't connect to server from the Internet.
  Perhaps direct connections are not allowed in the current network.
  To use proxy please check/specify these environment variables:
  - http_proxy/https_proxy
  - and/or HTTP_PROXY/HTTPS_PROXY
=======================================================================

CMake Warning at E:/opencv-3.4.5/opencv-3.4.5/cmake/OpenCVDownload.cmake:193 (message):
  data: Download failed: 7;"Couldn't connect to server"

  For details please refer to the download log file:

  E:/opencv-3.4.5/build/CMakeDownloadLog.txt

Call Stack (most recent call first):
  E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/face/CMakeLists.txt:13 (ocv_download)


CMake Warning at E:/opencv-3.4.5/opencv_contrib-3.4.5/modules/face/CMakeLists.txt:26 (message):
  Face: Can't get model file for face alignment.


CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
  CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
  directory
Call Stack (most recent call first):
  CMakeLists.txt:1074 (include)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272

第一处
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

第二处
在这里插入图片描述
在这里插入图片描述
文件下载完,并按指定命名格式存放在指定的位置之后,继续点击Configure,Generate
在这里插入图片描述
然后打开命令行开始编译:

mingw32-make -j 8
  • 1

在这里插入图片描述

mingw32-make install
  • 1

在这里插入图片描述
最后配置Qt工程如上(编译opencv)即可!!!


最后附上我的编译结果:

1、只编译了opencv版本
链接:https://pan.baidu.com/s/153K_qr-NWD0BqiUZft4vhQ
提取码:lpom

2、编译了opencv+opencv-contrib版本
链接:https://pan.baidu.com/s/1BGQ280dYWgu0IUj0jJvEWw
提取码:l8nm

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/132940
推荐阅读
相关标签
  

闽ICP备14008679号