Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4

QR-Code detector : multiple detection

* change in qr-codes detection

* change in qr-codes detection

* change in test

* change in test

* add multiple detection

* multiple detection

* multiple detect

* add parallel implementation

* add functional for performance tests

* change in test

* add perftest

* returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode

* deleted all lambda expressions

* changing in triangle sort

* fixed warnings

* fixed errors

* add java and python tests

* change in java tests

* change in java and python tests

* change in perf test

* change in qrcode.cpp

* add spaces

* change in qrcode.cpp

* change in qrcode.cpp

* change in qrcode.cpp

* change in java tests

* change in java tests

* solved problems

* solved problems

* change in java and python tests

* change in python tests

* change in python tests

* change in python tests

* change in methods name

* deleted sample qrcode_multi, change in qrcode.cpp

* change in perf tests

* change in objdetect.hpp

* deleted code duplication in sample qrcode.cpp

* returned spaces

* added spaces

* deleted draw function

* change in qrcode.cpp

* change in qrcode.cpp

* deleted all draw functions

* objdetect(QR): extractVerticalLines

* objdetect(QR): whitespaces

* objdetect(QR): simplify operations, avoid duplicated code

* change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera

* fix warnings and errors in python test

* fix

* write in file with space key

* solved error with empty mat check in python test

* correct path to test image

* deleted spaces

* solved error with check empty mat in python tests

* added check of empty vector of points

* samples: rework qrcode.cpp

* objdetect(QR): fix API, input parameters must be first

* objdetect(QR): test/fix points layout
This commit is contained in:
Polina Smolnikova
2020-01-26 22:18:42 +03:00
committed by Alexander Alekhin
parent 282a15c9f9
commit acc089ca64
8 changed files with 1887 additions and 255 deletions
@@ -694,8 +694,8 @@ public:
CV_WRAP bool detect(InputArray img, OutputArray points) const;
/** @brief Decodes QR code in image once it's found by the detect() method.
Returns UTF8-encoded output string or empty string if the code cannot be decoded.
Returns UTF8-encoded output string or empty string if the code cannot be decoded.
@param img grayscale or color (BGR) image containing QR code.
@param points Quadrangle vertices found by detect() method (or some other algorithm).
@param straight_qrcode The optional output image containing rectified and binarized QR code
@@ -705,11 +705,44 @@ public:
/** @brief Both detects and decodes QR code
@param img grayscale or color (BGR) image containing QR code.
@param points opiotnal output array of vertices of the found QR code quadrangle. Will be empty if not found.
@param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found.
@param straight_qrcode The optional output image containing rectified and binarized QR code
*/
CV_WRAP cv::String detectAndDecode(InputArray img, OutputArray points=noArray(),
OutputArray straight_qrcode = noArray());
/** @brief Detects QR codes in image and returns the vector of the quadrangles containing the codes.
@param img grayscale or color (BGR) image containing (or not) QR codes.
@param points Output vector of vector of vertices of the minimum-area quadrangle containing the codes.
*/
CV_WRAP
bool detectMulti(InputArray img, OutputArray points) const;
/** @brief Decodes QR codes in image once it's found by the detect() method.
@param img grayscale or color (BGR) image containing QR codes.
@param decoded_info UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.
@param points vector of Quadrangle vertices found by detect() method (or some other algorithm).
@param straight_qrcode The optional output vector of images containing rectified and binarized QR codes
*/
CV_WRAP
bool decodeMulti(
InputArray img, InputArray points,
CV_OUT std::vector<cv::String>& decoded_info,
OutputArrayOfArrays straight_qrcode = noArray()
) const;
/** @brief Both detects and decodes QR codes
@param img grayscale or color (BGR) image containing QR codes.
@param decoded_info UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded.
@param points optional output vector of vertices of the found QR code quadrangles. Will be empty if not found.
@param straight_qrcode The optional output vector of images containing rectified and binarized QR codes
*/
CV_WRAP
bool detectAndDecodeMulti(
InputArray img, CV_OUT std::vector<cv::String>& decoded_info,
OutputArray points = noArray(),
OutputArrayOfArrays straight_qrcode = noArray()
) const;
protected:
struct Impl;
Ptr<Impl> p;
@@ -731,6 +764,29 @@ CV_EXPORTS bool detectQRCode(InputArray in, std::vector<Point> &points, double e
*/
CV_EXPORTS bool decodeQRCode(InputArray in, InputArray points, std::string &decoded_info, OutputArray straight_qrcode = noArray());
/** @brief Detect QR codes in image and return vector of minimum area of quadrangle that describes QR codes.
@param in Matrix of the type CV_8UC1 containing an image where QR codes are detected.
@param points Output vector of vertices of quadrangles of minimal area that describes QR codes.
@param eps_x Epsilon neighborhood, which allows you to determine the horizontal pattern of the scheme 1:1:3:1:1 according to QR code standard.
@param eps_y Epsilon neighborhood, which allows you to determine the vertical pattern of the scheme 1:1:3:1:1 according to QR code standard.
*/
CV_EXPORTS
bool detectQRCodeMulti(
InputArray in, std::vector<Point> &points,
double eps_x = 0.2, double eps_y = 0.1);
/** @brief Decode QR codes in image and return text that is encrypted in QR code.
@param in Matrix of the type CV_8UC1 containing an image where QR code are detected.
@param points Input vector of vertices of quadrangles of minimal area that describes QR codes.
@param decoded_info vector of String information that is encrypted in QR codes.
@param straight_qrcode vector of Matrixes of the type CV_8UC1 containing an binary straight QR codes.
*/
CV_EXPORTS
bool decodeQRCodeMulti(
InputArray in, InputArray points,
CV_OUT std::vector<std::string> &decoded_info,
OutputArrayOfArrays straight_qrcode = noArray());
//! @} objdetect
}