Skip to content
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

5.x merge 4.x #3634

Merged
merged 7 commits into from
Feb 12, 2024
Merged

5.x merge 4.x #3634

merged 7 commits into from
Feb 12, 2024

Conversation

asmorkalov
Copy link
Contributor

@asmorkalov asmorkalov commented Feb 8, 2024

Main OpenCV: opencv/opencv#24981
OpenCV Extra: opencv/opencv_extra#1147

#3617 from chobitsfan:cuda_gftt_set_maxcorners
#3626 from zanaviska:feature/gcc11-warning-in-edge-drawing
#3632 from troelsy:4.x

Previous "Merge 4.x": #3628

chobitsfan and others added 7 commits January 5, 2024 14:13
‘error’ may be used uninitialized
add maxconers and mindistance setter to gftt
Fix a bug in knnMatchConvert when a feature couldn't be matched opencv#3632

After I started using a mask with `knnMatchAsync`, I found that the result from `knnMatchConvert` would be clipped at random.

Investigating the issue, I found that `knnMatchAsync` will initialize all `trainIdx` to `-1`, which will be overwritten by the CUDA kernel. A mask can be used to prevent certain features from being matched and this will prevent the CUDA kernel from setting the match distance. `knnMatchConvert` is not properly incrementing the pointers when `trainIdx == -1`, so an unmatched feature will get it stuck at `if (trainIdx == -1)`. Eventually the outer for-loop finishes and returns a vector with the matches up until the first missing match distance.

My solution is to increment the counters the same way as a successful iteration would.

### 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.
- [x] The feature is well documented and sample code can be built with the project CMake
@asmorkalov asmorkalov merged commit f63396a into opencv:5.x Feb 12, 2024
8 of 9 checks passed
@asmorkalov asmorkalov mentioned this pull request Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants