mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge branch 4.x
This commit is contained in:
@@ -960,6 +960,7 @@ public:
|
||||
double epsX, epsY;
|
||||
mutable vector<vector<Point2f>> alignmentMarkers;
|
||||
mutable vector<Point2f> updateQrCorners;
|
||||
mutable vector<QRCodeEncoder::ECIEncodings> encodings;
|
||||
bool useAlignmentMarkers = true;
|
||||
|
||||
bool detect(InputArray in, OutputArray points) const override;
|
||||
@@ -975,6 +976,8 @@ public:
|
||||
String decodeCurved(InputArray in, InputArray points, OutputArray straight_qrcode);
|
||||
|
||||
std::string detectAndDecodeCurved(InputArray in, OutputArray points, OutputArray straight_qrcode);
|
||||
|
||||
QRCodeEncoder::ECIEncodings getEncoding(int codeIdx);
|
||||
};
|
||||
|
||||
QRCodeDetector::QRCodeDetector() {
|
||||
@@ -991,6 +994,13 @@ QRCodeDetector& QRCodeDetector::setEpsY(double epsY) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
QRCodeEncoder::ECIEncodings QRCodeDetector::getEncoding(int codeIdx) {
|
||||
auto& encodings = std::dynamic_pointer_cast<ImplContour>(p)->encodings;
|
||||
CV_Assert(codeIdx >= 0);
|
||||
CV_Assert(codeIdx < static_cast<int>(encodings.size()));
|
||||
return encodings[codeIdx];
|
||||
}
|
||||
|
||||
bool ImplContour::detect(InputArray in, OutputArray points) const
|
||||
{
|
||||
Mat inarr;
|
||||
@@ -1032,6 +1042,8 @@ public:
|
||||
uint8_t total_num = 1;
|
||||
} structure_info;
|
||||
|
||||
QRCodeEncoder::ECIEncodings eci;
|
||||
|
||||
protected:
|
||||
double getNumModules();
|
||||
Mat getHomography() {
|
||||
@@ -2799,7 +2811,6 @@ static std::string encodeUTF8_bytesarray(const uint8_t* str, const size_t size)
|
||||
|
||||
bool QRDecode::decodingProcess()
|
||||
{
|
||||
QRCodeEncoder::ECIEncodings eci;
|
||||
const uint8_t* payload;
|
||||
size_t payload_len;
|
||||
|
||||
@@ -2858,7 +2869,7 @@ bool QRDecode::decodingProcess()
|
||||
return true;
|
||||
case QRCodeEncoder::EncodeMode::MODE_KANJI:
|
||||
// FIXIT BUG: we must return UTF-8 compatible string
|
||||
CV_LOG_WARNING(NULL, "QR: Kanji is not supported properly");
|
||||
eci = QRCodeEncoder::ECIEncodings::ECI_SHIFT_JIS;
|
||||
result_info.assign((const char*)payload, payload_len);
|
||||
return true;
|
||||
case QRCodeEncoder::EncodeMode::MODE_ECI:
|
||||
@@ -2929,6 +2940,7 @@ std::string ImplContour::decode(InputArray in, InputArray points, OutputArray st
|
||||
alignmentMarkers = {qrdec.alignment_coords};
|
||||
updateQrCorners = qrdec.getOriginalPoints();
|
||||
}
|
||||
encodings.resize(1, qrdec.eci);
|
||||
return ok ? decoded_info : std::string();
|
||||
}
|
||||
|
||||
@@ -2962,6 +2974,7 @@ String ImplContour::decodeCurved(InputArray in, InputArray points, OutputArray s
|
||||
{
|
||||
qrdec.getStraightBarcode().convertTo(straight_qrcode, CV_8UC1);
|
||||
}
|
||||
encodings.resize(1, qrdec.eci);
|
||||
|
||||
return ok ? decoded_info : std::string();
|
||||
}
|
||||
@@ -4074,20 +4087,22 @@ bool ImplContour::decodeMulti(
|
||||
straight_qrcode.assign(tmp_straight_qrcodes);
|
||||
}
|
||||
|
||||
decoded_info.clear();
|
||||
decoded_info.resize(info.size());
|
||||
encodings.resize(info.size());
|
||||
for (size_t i = 0; i < info.size(); i++)
|
||||
{
|
||||
auto& decoder = qrdec[i];
|
||||
encodings[i] = decoder.eci;
|
||||
if (!decoder.isStructured())
|
||||
{
|
||||
decoded_info.push_back(info[i]);
|
||||
decoded_info[i] = info[i];
|
||||
continue;
|
||||
}
|
||||
|
||||
// Store final message corresponding to 0-th code in a sequence.
|
||||
if (decoder.structure_info.sequence_num != 0)
|
||||
{
|
||||
decoded_info.push_back("");
|
||||
decoded_info[i] = "";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -4108,7 +4123,7 @@ bool ImplContour::decodeMulti(
|
||||
break;
|
||||
}
|
||||
}
|
||||
decoded_info.push_back(decoded);
|
||||
decoded_info[i] = decoded;
|
||||
}
|
||||
|
||||
alignmentMarkers.resize(src_points.size());
|
||||
|
||||
Reference in New Issue
Block a user