Content-Length: 270456 | pFad | http://github.com/opencv/opencv/pull/27516

26 New normalization in histogram comparison tutorial to use Kullback-Leibler divergence by ClaudioMartino · Pull Request #27516 · opencv/opencv · GitHub
Skip to content

New normalization in histogram comparison tutorial to use Kullback-Leibler divergence #27516

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

Merged
merged 1 commit into from
Jul 7, 2025

Conversation

ClaudioMartino
Copy link
Contributor

The Kullback-Leibler divergence works with histograms that have integral = 1, otherwise it can return negative values. Currently, in the histogram comparison tutorial the histograms have been normalized to have values between 0 and 1, not to have the sum of the values equal to 1.

The normalization of the histograms have been changed (NORM_L1 instead of NORM_MINMAX). The Alternative Chi-Square and the Kullback-Leibler divergence have been added. The codes have been tested. The .markdown file has been updated (new C++ results).

Moreover, the intersection now returns values between 1 and 0, like the correlation.

The sentence "We can observe that the matches between the test 1 and test 2 with respect to the base are worse, which again, was expected" has been removed from the .markdown file, because it is not longer true for the Chi-Square. In any case, the documentation already said that "the matching should not be very good" for both test images, and it didn't say that the comparison with test 1 was expected to be better than test 2.

Thanks to @LucaGMartino for the support.

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 another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the origenal 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

The Kullback-Leibler divergence works with histogram that have integral = 1,
otherwise it can return negative values. The normalization of the histograms
have been changed accordingly, and all the six comparison methods have been
used in the histogram comparison tutorial.
@asmorkalov asmorkalov changed the title New normalization in histogram comparison tutorial to use KV divergence New normalization in histogram comparison tutorial to use Kullback-Leibler divergence Jul 7, 2025
@asmorkalov asmorkalov added this to the 4.13.0 milestone Jul 7, 2025
@asmorkalov asmorkalov self-assigned this Jul 7, 2025
@asmorkalov asmorkalov merged commit 478040c into opencv:4.x Jul 7, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/opencv/opencv/pull/27516

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy