window Under the use of opencv And opencv support QT

software environment
MinGW-5.1.0-32bit( Downloaded QT There are )

1 compile opencv WITH_QT 
   Download it from the official website and compile it opencv, I won't support it QT
   So you need to compile it yourself
2 Downloaded OpenCV The folder will have :
  build ( Compiled Library , use MSVC The words of , Directly in )
  sources ( Source code )
  QT Using MinGW edition , So you need to compile it yourself ,
  MinGW Version of opencv( support QT) Compilation process
 (1)CMake Self installation
 (2)MinGW It can be used directly qt Inside

   open cmake-gui, Set source code and generation path :
  Where is the source code: E:/OpenCV_2.4.9/opencv/sources
  Where to build the binaries:
E:/OpenCV_2.4.9/opencv-build( Any name , Don't mix with what you already have build Just overlap )
   click Configure, Set up compiler
  Specify the generator for this project: MinGW Makefiles
  Specify native compilers
  Compilers C: E:\Qt\Qt5.9.3\Tools\mingw530_32\bin\gcc.exe
  Compilers C++: E:\Qt\Qt5.9.3\Tools\mingw530_32\bin\g++.exe
   A series of red colors appear ,
     Check WITH_QT
     Check WITH_OPENGL
     Do not check WITH_IPP
   Click again Configure, The following setting options appear
   set up QT_MAKE_EXECUTABLE by E:\Qt\Qt5.9.3\5.9.3\mingw53_32\bin\qmake.exe
   set up Qt5Concurrent_DIR by E:\Qt\Qt5.9.3\5.9.3\mingw53_32\lib\cmake\Qt5Concurrent
   set up Qt5Core_DIR by E:\Qt\Qt5.9.3\5.9.3\mingw53_32\lib\cmake\Qt5Core
   set up Qt5Gui_DIR by E:\Qt\Qt5.9.3\5.9.3\mingw53_32\lib\cmake\Qt5Gui 0
   set up Qt5Test_DIR by E:\Qt\Qt5.9.3\5.9.3\mingw53_32\lib\cmake\Qt5Test
   set up Qt5Widgets_DIR by E:\Qt\Qt5.9.3\5.9.3\mingw53_32\lib\cmake\Qt5Widgets
   set up Qt5OpenGL_DIR by E:\Qt\Qt5.9.3\5.9.3\mingw53_32\lib\cmake\Qt5OpenGL

   click Generate generate Makefile

  ** compile OpenCV**
   Go to the directory you set up before (E:/OpenCV_2.4.9/opencv-build)
   Direct operation E:\Qt\Qt5.9.3\Tools\mingw530_32\bin\mingw32-make
  ( Best setting E:\Qt\Qt5.9.3\Tools\mingw530_32\bin Is the system variable )
   If there is a problem with the compilation , Baidu , I did it all at once

   Compile and install
   function mingw32-make install
   It's best to do it
  G:\paper\opencv249\build\install\x64\mingw\bin Lower generation *249.dll
  G:\paper\opencv249\build\install\x64\mingw\lib   Lower generation *249.dll.a

  G:\paper\opencv249\build\install\x64\mingw\bin Set to the system variable
3  QT Use the compiled opencv
   .po Set in file
    INCLUDEPATH += G:\paper\opencv249\build\install\include
    INCLUDEPATH += G:\paper\opencv249\build\install\include\opencv
    INCLUDEPATH += G:\paper\opencv249\build\install\include\opencv2

LIBS +=G:\paper\opencv249\build\install\x64\mingw\lib\libopencv_core249.dll.a\







main file :
#include "opencv2/opencv.hpp"
const std::string input_file_name = "input.png";
cv::Mat image = imread(input_file_name);

If it appears
G:\01miwork\qtpro2\bandTest\main.cpp:11: error: undefined reference to
`cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&,

.po Set in file

Remember to rebuild


©2019-2020 Toolsou All rights reserved,
rk3399_android7.1 debugging USB Summary of Bluetooth module jmeter-while Summary of controller use use mt-range The effect of changing a number with the sliding bar is realized element ui Drop down box search function ToastUtils Use of ( Essence )2020 year 7 month 15 day Wechat applet assembly Component Use of vue vue-element-admin Summary of the project ( Essence 2020 year 6 month 2 Daily update ) TypeScript Function explanation SQL Server Database Glossary PHP Printout log