Merge pull request #25046 from AleksandrPanov:fix_QRArucoParameters

fix setArucoParameters in QRCodeDetectorAruco, add const to getArucoParameters
pull/25054/head
Alexander Smorkalov 1 year ago committed by GitHub
commit f8ef646312
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      modules/objdetect/include/opencv2/objdetect.hpp
  2. 8
      modules/objdetect/src/qrcode.cpp

@ -854,7 +854,7 @@ public:
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();
CV_WRAP const aruco::DetectorParameters& getArucoParameters() const;
/** @brief Aruco detector parameters are used to search for the finder patterns. */
CV_WRAP void setArucoParameters(const aruco::DetectorParameters& params);

@ -4615,13 +4615,13 @@ vector<QRCode> analyzeFinderPatterns(const vector<vector<Point2f> > &corners, co
struct PimplQRAruco : public ImplContour {
QRCodeDetectorAruco::Params qrParams;
aruco::ArucoDetector arucoDetector;
aruco::DetectorParameters arucoParams;
PimplQRAruco() {
Mat bits = Mat::ones(Size(5, 5), CV_8UC1);
Mat(bits, Rect(1, 1, 3, 3)).setTo(Scalar(0));
Mat byteList = aruco::Dictionary::getByteListFromBits(bits);
aruco::Dictionary dictionary = aruco::Dictionary(byteList, 5, 4);
aruco::DetectorParameters arucoParams;
arucoParams.minMarkerPerimeterRate = 0.02;
arucoDetector = aruco::ArucoDetector(dictionary, arucoParams);
}
@ -4695,12 +4695,12 @@ QRCodeDetectorAruco& QRCodeDetectorAruco::setDetectorParameters(const QRCodeDete
return *this;
}
aruco::DetectorParameters QRCodeDetectorAruco::getArucoParameters() {
return std::dynamic_pointer_cast<PimplQRAruco>(p)->arucoParams;
const aruco::DetectorParameters& QRCodeDetectorAruco::getArucoParameters() const {
return std::dynamic_pointer_cast<PimplQRAruco>(p)->arucoDetector.getDetectorParameters();
}
void QRCodeDetectorAruco::setArucoParameters(const aruco::DetectorParameters& params) {
std::dynamic_pointer_cast<PimplQRAruco>(p)->arucoParams = params;
std::dynamic_pointer_cast<PimplQRAruco>(p)->arucoDetector.setDetectorParameters(params);
}
} // namespace

Loading…
Cancel
Save