This package provides implementations of several commonly used histogram
- Kullback-Leibler Divergence
- Jenson-Shannon Divergence
- Jeffrey Divergence
- (Histogram) Intersection
- (Histogram) Match
- Quadratic form
The package comes with an example of color image matching (although this might
not be the best application idea, imho; anyway, it showcases the code).
I have applied some of the histogram distance functions for outlier reduction
when learning color term/name models from web images, see:
 B. Schauerte, G. A. Fink, "Web-based Learning of Naturalized Color Models
for Human-Machine Interaction". In Proceedings of the 12th International
Conference on Digital Image Computing: Techniques and Applications
(DICTA), IEEE, Sydney, Australia, December 1-3, 2010.
 B. Schauerte, R. Stiefelhagen, "Learning Robust Color Name Models from Web
Images". In Proceedings of the 21st International Conference on Pattern
Recognition (ICPR), Tsukuba, Japan, November 11-15, 2012
If you use and like this code, you are kindly requested to cite some of
the work above.
Boris Schauerte (2020). Histogram distances (https://www.mathworks.com/matlabcentral/fileexchange/39275-histogram-distances), MATLAB Central File Exchange. Retrieved .
I think there is a mistake in the hist_dist_example.m. r_bins, g_bins and b_bins in line 48-50 are the same. I think it the thirs index of IR should represent the color 1=red, 2=green, 3=blue, something like:
[~,r_bins] = histc(reshape(IR(:,:,1),1,),edges); r_bins = r_bins + 1;
[~,g_bins] = histc(reshape(IR(:,:,2),1,),edges); g_bins = g_bins + 1;
[~,b_bins] = histc(reshape(IR(:,:,3),1,),edges); b_bins = b_bins + 1;
Because as is the best match can be a picture with a different color.
Else I see potential in the pdist compatible functions for my application
@Muhammad: You should have a look in the section marked "match histograms and show best matching pairs" in hist_dist_example.m. In any case, the interface is compatible with Matlab's pdist2 function, which makes it fairly simple.
Hi, I want to compare two histograms , can you give Running Example from your code
I got an error running this, but
the fix is simple, the error and
the patch are below:
??? Error using ==> imread at 387
Unable to determine the file format.
Error in ==> hist_dist_example at 83
i had to change http to https
diff -r 090ae7bb4029 hist_dist_example.m
--- a/hist_dist_example.m Thu May 09 07:20:13 2013 -0700
+++ b/hist_dist_example.m Thu May 09 13:55:26 2013 -0700
@@ -58,7 +58,7 @@
[~,status] = urlwrite(url,fullfile(tmp_foldername,filename));
@K E: No. The distance functions should not depend on any other package/toolbox. As for the example in hist_dist_example.m, I think that squareform/pdist2 are part of the Statistics Toolbox, BUT you should be able to run it without the toolbox if you use the code block marked by "Use the following loop to calculate the distances, iff the measure is not symmetric" (just umcomment/comment the necessary code lines).
Do you need the Statistics Toolbox for these codes?
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!