cv_32s and comparehist

asked 2015-05-26 23:29:09 -0500

fredreload gravatar image

I managed to produce histograms of cv_32s by following this tutorial (, but the problem is after getting the two histograms I would like to compare them using a compare function, but comparehist would not take a histogram of cv_32s format. If I change the format to cv_32f it would not give the right answer for Kullback Leibler(cv_kl_div) comparison. So how can I compare 2 cv_32s histograms with Kullback Leibler?

edit retag flag offensive close merge delete


i'm not sure, if having integer histograms makes sense here.

even if you avoid compareHist (which indeed only works with float) and write your own distance function , you'll arrive at the a * log(a/b) term, and wherever b is smaller than a, you're doing a integer division, resulting in log(0) == -inf .

thoughts ?

berak gravatar imageberak ( 2015-05-27 04:47:48 -0500 )edit