Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandrPanov committed Apr 6, 2023
1 parent 7538eb2 commit 3e981d0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
1 change: 0 additions & 1 deletion modules/objdetect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ ocv_define_module(objdetect
opencv_core
opencv_imgproc
opencv_calib3d
opencv_highgui
OPTIONAL
opencv_dnn
WRAP
Expand Down
14 changes: 6 additions & 8 deletions modules/objdetect/include/opencv2/objdetect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,25 +778,25 @@ struct CV_EXPORTS_W_SIMPLE QRDetectorParameters {
CV_PROP_RW float minModuleSizeInPyramid = 4.f;

// The maximum allowed rotation relative diff for finder patterns in one QR code
float maxRotateDiff = (float)CV_PI/12.f;
CV_PROP_RW float maxRotateDiff = (float)CV_PI/12.f;

// The maximum allowed module relative diff for finder patterns in one QR code
float maxRelativeModuleDiff = 1.75f;
CV_PROP_RW float maxRelativeModuleDiff = 1.75f;

// The maximum allowed module relative diff for timing pattern module
// If relative diff of timing pattern module more this values, calculateTimingPattern() will add penalty points.
// If calculateTimingPattern() add many penalty points, QR code will be rejected.
float maxTimingPatternDiff = 2.f;
CV_PROP_RW float maxTimingPatternDiff = 2.f;

// The maximum allowed percentage of penalty points out of total pins in timing pattern.
float maxPenalties = 0.4f;
CV_PROP_RW float maxPenalties = 0.4f;

// The maximum allowed color difference in the timing pattern.
float maxColorsDelta = 0.2f;
CV_PROP_RW float maxColorsDelta = 0.2f;

// The algorithm find QR codes with almost minimum timing pattern score and minimum size
// For best QR code timingPatternScore*maxTimingScoreDiff < anyQrTimingPatternScore and size < anyQrSize
float maxTimingScoreDiff = 0.9f;
CV_PROP_RW float maxTimingScoreDiff = 0.9f;
};

class CV_EXPORTS_W QRCodeDetector
Expand Down Expand Up @@ -872,8 +872,6 @@ class CV_EXPORTS_W QRCodeDetector
CV_WRAP
bool detectMulti(InputArray img, OutputArray points) const;

//CV_WRAP bool detectMultiAruco(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.
Expand Down
6 changes: 2 additions & 4 deletions modules/objdetect/src/qrcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,9 +958,7 @@ struct QRCodeDetector::Impl
epsY = 0.1;
if (qrDetectorParameters.qrDetectMethod == QRDetectMethod::ARUCO) {
Mat bits = Mat::ones(Size(5, 5), CV_8UC1);
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
bits.at<uint8_t>(i+1, j+1) = 0;
Mat(bits, Rect(1, 1, 3, 3)).setTo(Scalar(0));;
using namespace aruco;
Mat byteList = Dictionary::getByteListFromBits(bits);
Dictionary dictionary = Dictionary(byteList, 5, 4);
Expand Down Expand Up @@ -3974,7 +3972,7 @@ struct FinderPatternInfo {
}

// return (total white+black pins, total first color, penaltyPoints)
Point3i calculateTimingPattern(Point2f start, Point2f end, Mat &img, const float maxTimingPatternDiff) const {
Point3i calculateTimingPattern(const Point2f& start, const Point2f& end, Mat &img, const float maxTimingPatternDiff) const {
Rect imageRect(Point(), img.size());
int penaltyPoints = 0;
int colorCounters[2] = {0, 0};
Expand Down
2 changes: 1 addition & 1 deletion modules/objdetect/test/test_qr_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void check_qr(const string& root, const string& name_current_image, const string
}
}
else {
for (int i = 0; i < corners.size(); i++) {
for (int i = 0; i < (int)corners.size(); i++) {
int x = config["x"][i];
int y = config["y"][i];
EXPECT_NEAR(x, corners[i].x, pixels_error);
Expand Down

0 comments on commit 3e981d0

Please sign in to comment.