# cv_32s and comparehist

I managed to produce histograms of cv_32s by following this tutorial (http://opencv-code.com/tutorials/draw...), 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 close merge delete

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 .