Open
Description
System information (version)
- OpenCV => 4.10.0
- Operating System / Platform => Ubuntu20.04
- Compiler => gcc9
Detailed description
I use the wechat_qrcode module of OpenCV4.10.0 for QR code recognition. Due to program dependencies, I need to use a higher version of protobuf. When I use protobuf version<=3.19, my program can load the caffe model and recognize the QR code normally. But if I upgrade the version of protobuf to 3.24.2 (protobuf version is confirmed to match), loading the model will throw an exception
My code is as follows
cv::Ptr<cv::wechat_qrcode::WeChatQRCode> detector_;
try {
std::string detect_prototxt = "detect.prototxt";
std::string detect_caffemodel = "detect.caffemodel";
std::string sr_prototxt ="sr.prototxt";
std::string sr_caffemodel = "sr.caffemodel";
detector_ = cv::makePtr<cv::wechat_qrcode::WeChatQRCode>(
detect_prototxt, detect_caffemodel, sr_prototxt, sr_caffemodel);
} catch (const std::exception& e) {
std::cout <<
"\n---------------------------------------------------------------\n"
"Failed to initialize WeChatQRCode.\n"
"Please, download 'detector.*' and 'sr.*' from\n"
"https://github.com/WeChatCV/opencv_3rdparty/tree/wechat_qrcode\n"
"and put them into the current directory.\n"
"---------------------------------------------------------------\n";
std::cout << e.what() << std::endl;
}
std::vector<std::string> res =detector_->detectAndDecode(img, points);
Corresponding program exception
Failed to initialize WeChatQRCode.
Please, download 'detector.*' and 'sr.*' from
https://github.com/WeChatCV/opencv_3rdparty/tree/wechat_qrcode
and put them into the current directory.
---------------------------------------------------------------
OpenCV(4.10.0) /home/user/zros/out/opencv-4.10.0/modules/dnn/src/caffe/caffe_importer.cpp:603: error: (-2:Unspecified error) DNN/Caffe: Build OpenCV with Protobuf to import Caffe models in function 'readNetFromCaffe'