Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Histogram intersection return wrong distance #156

Closed
FabRez opened this issue Apr 7, 2023 · 2 comments · Fixed by #158
Closed

Histogram intersection return wrong distance #156

FabRez opened this issue Apr 7, 2023 · 2 comments · Fixed by #158
Assignees

Comments

@FabRez
Copy link

FabRez commented Apr 7, 2023

Histogram intersection method returns $\rm 1 - H(I,M)$ instead of $\rm H(I,M)$.

From Swain and Ballard 1991, Histogram intersection is defined as :

$\rm H_{SW}(I,M) = \dfrac{\sum_i \min(I_i,M_i)}{\sum_i M_i}$

The class HistrogramIntersection, instead, calculates it as:

$\rm H_{FR}(I,M) = 1 - \dfrac{\sum_i \min(I_i,M_i)}{\sum_i M_i} = 1 - H_{SW}(I,M)$

This way the class calculates the "percentage" of non-intersection rather than that of the intersection of the two histograms.

@jaime-cespedes-sisniega
Copy link
Contributor

@FabRez Thanks for reporting this issue.

I have renamed that class to HINormalizedComplement to reflect that what you want to calculate is a distance between two distributions using the normalized complement of the histogram intersection of that distributions.

@FabRez
Copy link
Author

FabRez commented May 4, 2023

@jaime-cespedes-sisniega Thank you for fixing it. I am glad that this was useful

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants