4.5

4.5 | 2 ratings Rate this file 142 Downloads (last 30 days) File Size: 15.9 KB File ID: #39275

Histogram distances

by

 

03 Dec 2012 (Updated )

Implementation of some commonly used histogram distances (compatible with the pdist interface)

| Watch this File

File Information
Description

This package provides implementations of several commonly used histogram
distances:
- Kullback-Leibler Divergence
- Jenson-Shannon Divergence
- Jeffrey Divergence
- Chi-Square
- Kolmogorov-Smirnov
- (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:

[1] 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.
[2] 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.

MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
01 Sep 2013 Boris Schauerte

@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.

31 Aug 2013 Muhammad Ali Qadar

Hi, I want to compare two histograms , can you give Running Example from your code

21 Aug 2013 Derya  
09 May 2013 James Ganong

I got an error running this, but
the fix is simple, the error and
the patch are below:

ERROR MESSAGE

>> hist_dist_example
??? Error using ==> imread at 387
Unable to determine the file format.

Error in ==> hist_dist_example at 83
I=imread(fullfile(tmp_foldername,filenames{i}));

PATCH

i had to change http to https
like so:

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 @@
colorname=colornames{randi(numel(colornames))};
%colorname=colornames{1};
for j=1:numel(fendings)
- url=sprintf('http://cvhci.anthropomatik.kit.edu/~bschauer/datasets/google-512/images-resized-128/%s+color/%d.%s',colorname,i,fendings{j});
+ url=sprintf('https://cvhci.anthropomatik.kit.edu/~bschauer/datasets/google-512/images-resized-128/%s+color/%d.%s',colorname,i,fendings{j});
filename=sprintf('%s_%d.%s',colorname,i,fendings{j});
[~,status] = urlwrite(url,fullfile(tmp_foldername,filename));
if status

10 Jan 2013 Boris Schauerte

@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).

Bests
Boris

10 Jan 2013 K E

Do you need the Statistics Toolbox for these codes?

Updates
04 Dec 2012

- I forgot to add the example script in the initial submission. Fixed.

10 May 2013

- switched http to https when downloading example images, patch provided by James Ganong

Contact us