-
-
Notifications
You must be signed in to change notification settings - Fork 55.6k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Fix segfault in QRCodeDetector.detectAndDecodeCurved #23802
Conversation
d508fa8
to
4927bc1
Compare
The problem was in the original algorithm - PR #18003 @APrigarina, could you look at this solution or suggest another one? |
@opencv-alalek Could you take a look on the solution? |
@AleksandrPanov, @asmorkalov, frankly speaking, I don't like this hack. There is a general flexible method how to interpolate any polyline or any polygon using a spline. First, you introduce "time" axis t. The simplest (and probably good enough for this purpose) method is to set t=0 for the first point, t=1 for the second point etc. Then, instead of computing spline as y=y(x) you just build splines x=x(t) and y=y(t). Then you can compute intermediate points at any precision by choosing some fractional t values. In this case you don't need the proposed hack, because you can be sure that all t's are different. |
thanks a lot for the parametrization idea! |
c65e517
to
2562eb5
Compare
OK = 0, | ||
NEED_SWAP_AXES, | ||
NEED_ADD_PARAMETRIZATION |
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.
With parameterized spline we do not need branches any more.
Replaced by #25026 |
Fix qrcode bugs #25026 This PR fixes #22892, #24011 and #24450 and adds regression tests using the images provided. I've also verified with the [benchmark](https://github.com/opencv/opencv_benchmarks/tree/develop/python_benchmarks/qr_codes) that this doesn't break anything there. resolves #22892 resolves #24011 resolves #24450 Replaces #23802 Requires extra: opencv/opencv_extra#1148 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
fixes #22892
merge with opencv/opencv_extra#1072
The issue is in spline interpolation. Only the points of the function can be interpolated using splines, but the contour points may not be a function. There may be several points with the same x coordinate and different y. It results in getting NaN when calculating spline.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.