QT版本:5.13
【QT+OpenCV】车牌号检测 学习记录
首先在QT里面配置好OpenCV
.pro文件中加入:
INCLUDEPATH += G:/opencv/build/include
LIBS += -L"G:/opencv/build/x64/vc14/lib"\
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_ml \
-lopencv_video \
-lo
.cpp文件前面加上:
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/text.hpp>
配置过程中发现由于缺少opencv-contrib(OpenCV贡献模块),找不到text.hpp文件,于是又去下载了opencv-contrib
下载地址:opencv_contrib
再下一个Cmake ,下载Latest Release (最新稳定版)
Cmake
参考这个教程:Windows下CMake的下载与安装详解
使用Cmake进行编译,
教程:opencv_contrib安装笔记
中间遇到的问题
显示OpenBLAS,LAPACK,JNI,以及FFmpeg等开发库在系统中没有被找到
Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19044.
Detected processor: AMD64
CMake Warning (dev) at cmake/OpenCVUtils.cmake:144 (find_package):
Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
are removed. Run "cmake --help-policy CMP0148" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/OpenCVDetectPython.cmake:64 (find_host_package)
cmake/OpenCVDetectPython.cmake:271 (find_python)
CMakeLists.txt:622 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
libjpeg-turbo: VERSION = 2.1.0, BUILD = opencv-4.5.4-libjpeg-turbo
Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
OpenJPEG: VERSION = 2.4.0, BUILD = opencv-4.5.4-openjp2-2.4.0
OpenJPEG libraries will be built from sources: libopenjp2 (version "2.4.0")
CMake Error at cmake/OpenCVFindIPP.cmake:64 (string):
string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
command.
Call Stack (most recent call first):
cmake/OpenCVFindIPP.cmake:99 (ipp_get_version)
cmake/OpenCVFindIPP.cmake:276 (ipp_detect_version)
cmake/OpenCVFindLibsPerf.cmake:12 (include)
CMakeLists.txt:727 (include)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
OpenCV Python: during development append to PYTHONPATH: G:/opencv/opencv-build/python_loader
Module opencv_alphamat disabled because the following dependencies are not found: Eigen
freetype2: NO
harfbuzz: NO
Julia not found. Not compiling Julia Bindings.
Module opencv_ovis disabled because OGRE3D was not found
No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Tesseract: NO
Allocator metrics storage type: 'long long'
Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': G:/opencv/sources/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
opencv_dnn: filter out cuda4dnn source code
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.rvv.cpp
highgui: using builtin backend: WIN32UI
rgbd: Eigen support is disabled. Eigen is Required for Posegraph optimization
wechat_qrcode: Download: detect.caffemodel