Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork56.4k
Add detect qr with aruco#23264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Add detect qr with aruco#23264
Uh oh!
There was an error while loading.Please reload this page.
Conversation
asmorkalov left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please add:
- The table with benchmark results for 4.7 and new version;
- Performance test (parameterize existing) and it's result.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
bdbe5de to339e8a1CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
8602d7e to04785daComparefa28b6f to3e981d0CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
asmorkalov commentedApr 7, 2023
|
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
asmorkalov commentedApr 11, 2023
General notes:
|
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
cb7a30b to0d6eddfCompare3d9c6e5 tofca3934Compareasmorkalov commentedMay 17, 2023
@opencv-alalek Could you update ABI-complience-checker settings to cover API changes. |
Uh oh!
There was an error while loading.Please reload this page.
asmorkalov commentedMay 22, 2023
@opencv-alalek Friendly reminder. |
| /** @brief Aruco detector parameters are used to search for the finder patterns.*/ | ||
| CV_PROP_RW aruco::DetectorParameters arucoParams; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
broken indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
fixed
| ASSERT_FALSE(src.empty()) <<"Can't read image:" << image_path; | ||
| #ifdef HAVE_QUIRC | ||
| QRCodeDetector qrcode; | ||
| Ptr<QRCodeDetectorBase> qrcode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
PImpl doesn't needPtr<>. They are already smart pointers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
removed Ptr
samples/cpp/qrcode.cpp Outdated
| static | ||
| voidrunQR( | ||
| QRCodeDetector& qrcode,const Mat& input, | ||
| Ptr<QRCodeDetectorBase> qrcode,const Mat& input, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
- We don't need
Ptrfor PImpl which is already smart ptr. Ptrs must be passed as "const reference" be default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
removed Ptr, added ref
| @param epsX Epsilon neighborhood, which allows you to determine the horizontal pattern | ||
| of the scheme 1:1:3:1:1 according to QR code standard. | ||
| */ | ||
| CV_WRAPvoidsetEpsX(double epsX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
All "set" methods should return*this reference to allow construction chains.
AleksandrPanovMay 26, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
these setters drop CI (Python bindings)
Maybe update the setters later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In DNNpyopencv_cv_dnn_dnn_ClassificationModel_setEnableSoftmaxPostProcessing has been properly generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
done.
The directiveCV_EXPORTS_W_SIMPLE instead ofCV_EXPORTS_W directive helped to add setter
AleksandrPanovJun 1, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
first was addedQRCodeDetectorAruco& setDetectorParameters
now were addedQRCodeDetector& setEpsX,QRCodeDetector& setEpsY,QRCodeDetector& setUseAlignmentMarkers
now it's done)
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
c162f4f toe964404Compare4a81fc3 tob9d1942Compare| classCV_EXPORTS_W QRCodeDetector | ||
| { | ||
| classCV_EXPORTS_W QRCodeDetectorBase { | ||
| public: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
As mentioned on team meetings, we have to followdnn:Model approach.
Constructors / destructors / assignment / move operators should be defined explicitly.
Also we should not have public default constructor (but we have issue with bindings - deprecation and comment should be on-place).
AleksandrPanovMay 31, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
//CV_DEPRECATED_EXTERNAL
Why is it commented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
removed the comments
modules/objdetect/src/qrcode.cpp Outdated
| virtualbooldetectAndDecodeMulti(InputArray img, std::vector<std::string>& decoded_info, OutputArray points, | ||
| OutputArrayOfArrays straight_qrcode)const = 0; | ||
| virtual~Impl() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It is better to declare virtual destructor first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
done
| }; | ||
| boolQRCodeDetectorBase::detect(InputArray img, OutputArray points)const { | ||
| return p->detect(img, points); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
->
All deference cases must be pre-checked for NULL values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
addedCV_Assert(p != nullptr);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
JustCV_Assert(p) as we don't really want to retrieve the pointer itself.
It is likecontainer.size() == 0 vscontainer.empty().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
added justCV_Assert(p)
modules/objdetect/src/qrcode.cpp Outdated
| QRCodeDetector::QRCodeDetector() : p(new Impl) {} | ||
| QRCodeDetector::QRCodeDetector() { | ||
| p =newImplContour(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
new
makePtr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
replaced
modules/objdetect/src/qrcode.cpp Outdated
| CV_CheckGT(contourArea(src_points),0.0,"Invalid QR code source points"); | ||
| QRDecodeqrdec(p->useAlignmentMarkers); | ||
| QRDecodeqrdec((std::static_pointer_cast<ImplContour>)(p)->useAlignmentMarkers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
PImpl pattern classes should not have large method implementations.
All logic must go toImpl.
AleksandrPanovMay 31, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I propose to make this fix in another PR. This fix will erase the history and increase the diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I moveddecodeCurved anddetectAndDecodeCurved toImplContour. I think I've fixed everything you asked for. Is there anything else that needs to be fixed?
| @param epsX Epsilon neighborhood, which allows you to determine the horizontal pattern | ||
| of the scheme 1:1:3:1:1 according to QR code standard. | ||
| */ | ||
| CV_WRAPvoidsetEpsX(double epsX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In DNNpyopencv_cv_dnn_dnn_ClassificationModel_setEnableSoftmaxPostProcessing has been properly generated.
e633c4c tof860430Comparef860430 to866289eCompare
opencv-alalek left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM 👍
| classCV_EXPORTS_W QRCodeDetector | ||
| { | ||
| classCV_EXPORTS_W QRCodeDetectorBase { | ||
| public: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
//CV_DEPRECATED_EXTERNAL
Why is it commented?
| }; | ||
| boolQRCodeDetectorBase::detect(InputArray img, OutputArray points)const { | ||
| return p->detect(img, points); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
JustCV_Assert(p) as we don't really want to retrieve the pointer itself.
It is likecontainer.size() == 0 vscontainer.empty().
| vector<vector<Point2f>> alignmentMarkers; | ||
| vector<Point2f> updateQrCorners; | ||
| mutablevector<vector<Point2f>> alignmentMarkers; | ||
| mutablevector<Point2f> updateQrCorners; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
suspicious code, need to be revised later.
modules/objdetect/src/qrcode.cpp Outdated
| QRCodeDetector::~QRCodeDetector() {} | ||
| QRCodeDetector&QRCodeDetector::setEpsX(double epsX) { | ||
| (std::static_pointer_cast<ImplContour>)(p)->epsX = epsX; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
no need braces here:
std::static_pointer_cast<ImplContour>(p)
checkeddynamic_pointer_cast is more secure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
addeddynamic_pointer_cast insteadstatic_pointer_cast
| scaleTimingPatternScore =0.9f; | ||
| } | ||
| structFinderPatternInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
BTW, it makes sense to hide local internal classes (especially with some generic names) into inner anonymous namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
addedFinderPatternInfo andQRCode into anonymous namespace
samples/cpp/qrcode.cpp Outdated
| static | ||
| voidrunQR( | ||
| QRCodeDetector& qrcode,const Mat& input, | ||
| QRCodeDetectorBase& qrcode,const Mat& input, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Useconst reference for inputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
addedconst reference and added const todecode methods

Uh oh!
There was an error while loading.Please reload this page.
Using Aruco to detect finder patterns to search QR codes.
TODO (in next PR):
detect()anddetectAndDecode())decodestepCurrent results:
+20% total detect, +8% total decode in OpenCVQR benchmark
78.4% detect, 58.7% decode vs 58.5 detect, 50.5% decode in default
main.py.txt
add new info togoogle docs
Pull Request Readiness Checklist
See details athttps://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.