mirror of
https://github.com/opencv/opencv.git
synced 2025-06-11 20:09:23 +08:00

QR codes Structured Append decoding mode #24548 ### Pull Request Readiness Checklist resolves https://github.com/opencv/opencv/issues/23245 Merge after https://github.com/opencv/opencv/pull/24299 Current proposal is to use `detectAndDecodeMulti` or `decodeMulti` for structured append mode decoding. 0-th QR code in a sequence gets a full message while the rest of codes will correspond to empty strings. See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
// This file is part of OpenCV project.
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
// of this distribution and at http://opencv.org/license.html
|
|
#ifndef OPENCV_OBJDETECT_GRAPHICAL_CODE_DETECTOR_IMPL_HPP
|
|
#define OPENCV_OBJDETECT_GRAPHICAL_CODE_DETECTOR_IMPL_HPP
|
|
|
|
#include <opencv2/core.hpp>
|
|
|
|
namespace cv {
|
|
|
|
struct GraphicalCodeDetector::Impl {
|
|
virtual ~Impl() {}
|
|
virtual bool detect(InputArray img, OutputArray points) const = 0;
|
|
virtual std::string decode(InputArray img, InputArray points, OutputArray straight_code) const = 0;
|
|
virtual std::string detectAndDecode(InputArray img, OutputArray points, OutputArray straight_code) const = 0;
|
|
virtual bool detectMulti(InputArray img, OutputArray points) const = 0;
|
|
virtual bool decodeMulti(InputArray img, InputArray points, std::vector<std::string>& decoded_info,
|
|
OutputArrayOfArrays straight_code) const = 0;
|
|
virtual bool detectAndDecodeMulti(InputArray img, std::vector<std::string>& decoded_info,
|
|
OutputArray points, OutputArrayOfArrays straight_code) const = 0;
|
|
};
|
|
|
|
class QRCodeDecoder {
|
|
public:
|
|
virtual ~QRCodeDecoder();
|
|
|
|
static Ptr<QRCodeDecoder> create();
|
|
|
|
virtual bool decode(const Mat& straight, String& decoded_info) = 0;
|
|
|
|
QRCodeEncoder::EncodeMode mode;
|
|
QRCodeEncoder::ECIEncodings eci;
|
|
uint8_t parity = 0;
|
|
uint8_t sequence_num = 0;
|
|
uint8_t total_num = 1;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|