C++ 错误:';QRCodeDetector';不是';cv';
我试图在我的一个函数中使用opencvC++ 错误:';QRCodeDetector';不是';cv';,c++,opencv,C++,Opencv,我试图在我的一个函数中使用opencvQRCodeDetector类,但不幸的是,我得到了一个错误。 错误是说QRCodeDetector不是cv的成员 C++功能代码(test_qr.cpp): 我也尝试过做类似的事情: 但它没有帮助。无法在Windows 10、Visual Studio Professional 2019、OpenCV 4.5.0(www.OpenCV.org上的预构建DLL)上重新编译。您能提供完整的stacktrace吗?错误发生在编译过程中。这也是在Unix上,我使用
QRCodeDetector
类,但不幸的是,我得到了一个错误。
错误是说QRCodeDetector
不是cv
的成员
C++功能代码(test_qr.cpp):
我也尝试过做类似的事情:
但它没有帮助。无法在Windows 10、Visual Studio Professional 2019、OpenCV 4.5.0(www.OpenCV.org上的预构建DLL)上重新编译。您能提供完整的stacktrace吗?错误发生在编译过程中。这也是在Unix上,我使用的是OpenCV版本3.4.6
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/objdetect.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <vector>
#include <string>
void qrCheck(std::vector<std::string>& qrStorage, cv::Mat imageLeft_t0) {
cv::QRCodeDetector qrDecoder = cv::QRCodeDetector(); // Error on this line
std::string data = qrDecoder.detectAndDecode(imageLeft_t0);
if (data.length() > 0) {
std::cout << "QR Decoded Data: " << data << std::endl;
qrStorage.push_back(data);
} else
std::cout << "QR Code Not Detected" << std::endl;
}
cmake_minimum_required(VERSION 3.11)
project( DisplayImage )
set(CMAKE_CXX_STANDARD 11)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable( DisplayImage test_qr.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )