4545#define OPENCV_OBJDETECT_HPP
4646
4747#include " opencv2/core.hpp"
48+ #include " opencv2/objdetect/aruco_detector.hpp"
4849
4950/* *
5051@defgroup objdetect Object Detection
@@ -763,28 +764,15 @@ class CV_EXPORTS_W QRCodeEncoder {
763764
764765};
765766
766- class CV_EXPORTS_W QRCodeDetector
767- {
767+ class CV_EXPORTS_W_SIMPLE QRCodeDetectorBase {
768768public:
769- CV_WRAP QRCodeDetector ();
770- ~QRCodeDetector ();
769+ CV_DEPRECATED_EXTERNAL // avoid using in C++ code, will be moved to "protected" (need to fix bindings first)
770+ QRCodeDetectorBase ();
771771
772- /* * @brief sets the epsilon used during the horizontal scan of QR code stop marker detection.
773- @param epsX Epsilon neighborhood, which allows you to determine the horizontal pattern
774- of the scheme 1:1:3:1:1 according to QR code standard.
775- */
776- CV_WRAPvoid setEpsX (double epsX);
777- /* * @brief sets the epsilon used during the vertical scan of QR code stop marker detection.
778- @param epsY Epsilon neighborhood, which allows you to determine the vertical pattern
779- of the scheme 1:1:3:1:1 according to QR code standard.
780- */
781- CV_WRAPvoid setEpsY (double epsY);
782-
783- /* * @brief use markers to improve the position of the corners of the QR code
784- *
785- * alignmentMarkers using by default
786- */
787- CV_WRAPvoid setUseAlignmentMarkers (bool useAlignmentMarkers);
772+ QRCodeDetectorBase (const QRCodeDetectorBase&) =default ;
773+ QRCodeDetectorBase (QRCodeDetectorBase&&) =default ;
774+ QRCodeDetectorBase&operator =(const QRCodeDetectorBase&) =default ;
775+ QRCodeDetectorBase&operator =(QRCodeDetectorBase&&) =default ;
788776
789777/* * @brief Detects QR code in image and returns the quadrangle containing the code.
790778 @param img grayscale or color (BGR) image containing (or not) QR code.
@@ -799,16 +787,7 @@ class CV_EXPORTS_W QRCodeDetector
799787 @param points Quadrangle vertices found by detect() method (or some other algorithm).
800788 @param straight_qrcode The optional output image containing rectified and binarized QR code
801789*/
802- CV_WRAP std::stringdecode (InputArray img, InputArray points, OutputArray straight_qrcode = noArray());
803-
804- /* * @brief Decodes QR code on a curved surface in image once it's found by the detect() method.
805-
806- Returns UTF8-encoded output string or empty string if the code cannot be decoded.
807- @param img grayscale or color (BGR) image containing QR code.
808- @param points Quadrangle vertices found by detect() method (or some other algorithm).
809- @param straight_qrcode The optional output image containing rectified and binarized QR code
810- */
811- CV_WRAP cv::StringdecodeCurved (InputArray img, InputArray points, OutputArray straight_qrcode = noArray());
790+ CV_WRAP std::stringdecode (InputArray img, InputArray points, OutputArray straight_qrcode = noArray())const ;
812791
813792/* * @brief Both detects and decodes QR code
814793
@@ -817,16 +796,8 @@ class CV_EXPORTS_W QRCodeDetector
817796 @param straight_qrcode The optional output image containing rectified and binarized QR code
818797*/
819798 CV_WRAP std::stringdetectAndDecode (InputArray img, OutputArray points=noArray(),
820- OutputArray straight_qrcode = noArray());
821-
822- /* * @brief Both detects and decodes QR code on a curved surface
799+ OutputArray straight_qrcode = noArray())const ;
823800
824- @param img grayscale or color (BGR) image containing QR code.
825- @param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found.
826- @param straight_qrcode The optional output image containing rectified and binarized QR code
827- */
828- CV_WRAP std::stringdetectAndDecodeCurved (InputArray img, OutputArray points=noArray(),
829- OutputArray straight_qrcode = noArray());
830801
831802/* * @brief Detects QR codes in image and returns the vector of the quadrangles containing the codes.
832803 @param img grayscale or color (BGR) image containing (or not) QR codes.
@@ -860,18 +831,109 @@ class CV_EXPORTS_W QRCodeDetector
860831 OutputArray points = noArray(),
861832 OutputArrayOfArrays straight_qrcode = noArray()
862833 )const ;
863-
864- protected:
865834struct Impl ;
835+ protected:
866836 Ptr<Impl> p;
867837};
868838
839+ class CV_EXPORTS_W_SIMPLE QRCodeDetector : public QRCodeDetectorBase
840+ {
841+ public:
842+ CV_WRAPQRCodeDetector ();
843+
844+ /* * @brief sets the epsilon used during the horizontal scan of QR code stop marker detection.
845+ @param epsX Epsilon neighborhood, which allows you to determine the horizontal pattern
846+ of the scheme 1:1:3:1:1 according to QR code standard.
847+ */
848+ CV_WRAP QRCodeDetector&setEpsX (double epsX);
849+ /* * @brief sets the epsilon used during the vertical scan of QR code stop marker detection.
850+ @param epsY Epsilon neighborhood, which allows you to determine the vertical pattern
851+ of the scheme 1:1:3:1:1 according to QR code standard.
852+ */
853+ CV_WRAP QRCodeDetector&setEpsY (double epsY);
854+
855+ /* * @brief use markers to improve the position of the corners of the QR code
856+ *
857+ * alignmentMarkers using by default
858+ */
859+ CV_WRAP QRCodeDetector&setUseAlignmentMarkers (bool useAlignmentMarkers);
860+
861+ /* * @brief Decodes QR code on a curved surface in image once it's found by the detect() method.
862+
863+ Returns UTF8-encoded output string or empty string if the code cannot be decoded.
864+ @param img grayscale or color (BGR) image containing QR code.
865+ @param points Quadrangle vertices found by detect() method (or some other algorithm).
866+ @param straight_qrcode The optional output image containing rectified and binarized QR code
867+ */
868+ CV_WRAP cv::StringdecodeCurved (InputArray img, InputArray points, OutputArray straight_qrcode = noArray());
869+
870+ /* * @brief Both detects and decodes QR code on a curved surface
871+
872+ @param img grayscale or color (BGR) image containing QR code.
873+ @param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found.
874+ @param straight_qrcode The optional output image containing rectified and binarized QR code
875+ */
876+ CV_WRAP std::stringdetectAndDecodeCurved (InputArray img, OutputArray points=noArray(),
877+ OutputArray straight_qrcode = noArray());
878+ };
879+
880+ class CV_EXPORTS_W_SIMPLE QRCodeDetectorAruco : public QRCodeDetectorBase {
881+ public:
882+ CV_WRAPQRCodeDetectorAruco ();
883+
884+ struct CV_EXPORTS_W_SIMPLE Params {
885+ CV_WRAPParams ();
886+
887+ /* * @brief The minimum allowed pixel size of a QR module in the smallest image in the image pyramid, default 4.f*/
888+ CV_PROP_RWfloat minModuleSizeInPyramid;
889+
890+ /* * @brief The maximum allowed relative rotation for finder patterns in the same QR code, default pi/12*/
891+ CV_PROP_RWfloat maxRotation;
892+
893+ /* * @brief The maximum allowed relative mismatch in module sizes for finder patterns in the same QR code, default 1.75f*/
894+ CV_PROP_RWfloat maxModuleSizeMismatch;
895+
896+ /* * @brief The maximum allowed module relative mismatch for timing pattern module, default 2.f
897+ *
898+ * If relative mismatch of timing pattern module more this value, penalty points will be added.
899+ * If a lot of penalty points are added, QR code will be rejected.*/
900+ CV_PROP_RWfloat maxTimingPatternMismatch;
901+
902+ /* * @brief The maximum allowed percentage of penalty points out of total pins in timing pattern, default 0.4f*/
903+ CV_PROP_RWfloat maxPenalties;
904+
905+ /* * @brief The maximum allowed relative color mismatch in the timing pattern, default 0.2f*/
906+ CV_PROP_RWfloat maxColorsMismatch;
907+
908+ /* * @brief The algorithm find QR codes with almost minimum timing pattern score and minimum size, default 0.9f
909+ *
910+ * The QR code with the minimum "timing pattern score" and minimum "size" is selected as the best QR code.
911+ * If for the current QR code "timing pattern score" * scaleTimingPatternScore < "previous timing pattern score" and "size" < "previous size", then
912+ * current QR code set as the best QR code.*/
913+ CV_PROP_RWfloat scaleTimingPatternScore;
914+ };
915+
916+ /* * @brief QR code detector constructor for Aruco-based algorithm. See cv::QRCodeDetectorAruco::Params*/
917+ CV_WRAPexplicit QRCodeDetectorAruco (const QRCodeDetectorAruco::Params& params);
918+
919+ /* * @brief Detector parameters getter. See cv::QRCodeDetectorAruco::Params*/
920+ CV_WRAPconst QRCodeDetectorAruco::Params&getDetectorParameters ()const ;
921+
922+ /* * @brief Detector parameters setter. See cv::QRCodeDetectorAruco::Params*/
923+ CV_WRAP QRCodeDetectorAruco&setDetectorParameters (const QRCodeDetectorAruco::Params& params);
924+
925+ /* * @brief Aruco detector parameters are used to search for the finder patterns.*/
926+ CV_WRAP aruco::DetectorParametersgetArucoParameters ();
927+
928+ /* * @brief Aruco detector parameters are used to search for the finder patterns.*/
929+ CV_WRAPvoid setArucoParameters (const aruco::DetectorParameters& params);
930+ };
931+
869932// ! @}
870933}
871934
872935#include " opencv2/objdetect/detection_based_tracker.hpp"
873936#include " opencv2/objdetect/face.hpp"
874- #include " opencv2/objdetect/aruco_detector.hpp"
875937#include " opencv2/objdetect/charuco_detector.hpp"
876938
877939#endif