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

Fix clipping bug in SQDIFF_NORMED template matching #20003

Conversation

danielenricocahall
Copy link
Contributor

Addresses #15215 regarding CV_TM_SQDIFF_NORMED clipping at 1.0, despite the range being > 1. The test case is the example presented in the ticket.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • 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

@danielenricocahall danielenricocahall force-pushed the fix-template-matching-sqdiff-normed branch from 03e0b2e to b4be860 Compare May 22, 2021 12:33
@danielenricocahall
Copy link
Contributor Author

Hi @vpisarev! I'm having some trouble addressing the last few failing tests for the CL builds + Mac build. They all seem to be the same, and I can't replicate locally. It looks like the norm is still being clipped at 1 when the difference is computed - do you have any thoughts/suggestions?

@asmorkalov asmorkalov requested a review from vpisarev June 1, 2021 10:55
@asmorkalov
Copy link
Contributor

There is OpenCL implementation of MatchTemplate that follows the original function logic: https://github.com/opencv/opencv/blob/3.4/modules/imgproc/src/opencl/match_template.cl

@danielenricocahall
Copy link
Contributor Author

There is OpenCL implementation of MatchTemplate that follows the original function logic: https://github.com/opencv/opencv/blob/3.4/modules/imgproc/src/opencl/match_template.cl

@asmorkalov yes I saw that - I made changes to the function in that file to match the new logic, but it doesn't appear to be addressing the issue. With SQDIFF Normed, we should just be taking the numerator and the denominator with no conditionals.

@asmorkalov
Copy link
Contributor

@alalek I created PR opencv/opencv_extra#916 for sanity check update. Please take a look.

@asmorkalov asmorkalov added the port into 4.x is needed Label for maintainers. Authors of PR can ignore this label Sep 29, 2021
@alalek
Copy link
Member

alalek commented Sep 29, 2021

@asmorkalov Public CI is not able to collect patches from different users (not implemented because it is unusual case)

@asmorkalov
Copy link
Contributor

Replacement: #20770

@asmorkalov asmorkalov closed this Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug category: imgproc port into 4.x is needed Label for maintainers. Authors of PR can ignore this test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants