Skip to content

Commit

Permalink
add default construcor, update setter
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandrPanov committed May 30, 2023
1 parent e97cb72 commit f860430
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
10 changes: 6 additions & 4 deletions modules/objdetect/include/opencv2/objdetect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ class CV_EXPORTS_W QRCodeEncoder {

};

class CV_EXPORTS_W QRCodeDetectorBase {
class CV_EXPORTS_W_SIMPLE QRCodeDetectorBase {
public:
/** @brief Detects QR code in image and returns the quadrangle containing the code.
@param img grayscale or color (BGR) image containing (or not) QR code.
Expand Down Expand Up @@ -871,8 +871,10 @@ class CV_EXPORTS_W QRCodeDetector : public QRCodeDetectorBase
OutputArray straight_qrcode = noArray());
};

class CV_EXPORTS_W QRCodeDetectorAruco : public QRCodeDetectorBase {
class CV_EXPORTS_W_SIMPLE QRCodeDetectorAruco : public QRCodeDetectorBase {
public:
CV_WRAP QRCodeDetectorAruco();

struct CV_EXPORTS_W_SIMPLE Params {
CV_WRAP Params();

Expand Down Expand Up @@ -906,13 +908,13 @@ class CV_EXPORTS_W QRCodeDetectorAruco : public QRCodeDetectorBase {
};

/** @brief QR code detector constructor for Aruco-based algorithm. See cv::QRCodeDetectorAruco::Params */
CV_WRAP explicit QRCodeDetectorAruco(const QRCodeDetectorAruco::Params& params = QRCodeDetectorAruco::Params());
CV_WRAP explicit QRCodeDetectorAruco(const QRCodeDetectorAruco::Params& params);

/** @brief Detector parameters getter. See cv::QRCodeDetectorAruco::Params */
CV_WRAP const QRCodeDetectorAruco::Params& getDetectorParameters() const;

/** @brief Detector parameters setter. See cv::QRCodeDetectorAruco::Params */
CV_WRAP void setDetectorParameters(const QRCodeDetectorAruco::Params& params);
CV_WRAP QRCodeDetectorAruco& setDetectorParameters(const QRCodeDetectorAruco::Params& params);

/** @brief Aruco detector parameters are used to search for the finder patterns. */
CV_WRAP aruco::DetectorParameters getArucoParameters();
Expand Down
11 changes: 8 additions & 3 deletions modules/objdetect/src/qrcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ struct ImplContour : public QRCodeDetectorBase::Impl
};

QRCodeDetector::QRCodeDetector() {
p = new ImplContour();
p = makePtr<ImplContour>();
}

QRCodeDetector::~QRCodeDetector() {}
Expand Down Expand Up @@ -4538,17 +4538,22 @@ struct PimplQRAruco : public ImplContour {
}
};

QRCodeDetectorAruco::QRCodeDetectorAruco() {
p = makePtr<PimplQRAruco>();
}

QRCodeDetectorAruco::QRCodeDetectorAruco(const QRCodeDetectorAruco::Params& params) {
p = new PimplQRAruco();
p = makePtr<PimplQRAruco>();
(std::static_pointer_cast<PimplQRAruco>(p))->qrParams = params;
}

const QRCodeDetectorAruco::Params& QRCodeDetectorAruco::getDetectorParameters() const {
return (std::static_pointer_cast<PimplQRAruco>(p))->qrParams;
}

void QRCodeDetectorAruco::setDetectorParameters(const QRCodeDetectorAruco::Params& params) {
QRCodeDetectorAruco& QRCodeDetectorAruco::setDetectorParameters(const QRCodeDetectorAruco::Params& params) {
(std::static_pointer_cast<PimplQRAruco>(p))->qrParams = params;
return *this;
}

aruco::DetectorParameters QRCodeDetectorAruco::getArucoParameters() {
Expand Down

0 comments on commit f860430

Please sign in to comment.