Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

compareHist with HISTCMP_CORREL

$
0
0
I'm evaluating compareHist() and when I compare a 'flat' histogram with a single spike, the correlation value is 1.0! This is obviously wrong (by hand I get zero divided by zero but it should be approaching zero). Am I doing something wrong? Here's my code: import numpy, cv2 spike = numpy.ones((1,256), dtype=numpy.uint8).reshape(16, 16) * 127 flat = numpy.arange(256, dtype=numpy.uint8).reshape(16,16) # Calculate the histograms hist_s = cv2.calcHist([spike], [0], None, [256], [0, 256]) hist_f = cv2.calcHist([flat], [0], None, [256], [0, 256]) print cv2.compareHist(hist_f, hist_s, method=0) returns 1.0 Plot of the two histograms (spike=red, flat=blue): ![image description](/upfiles/14400271862802213.png)

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>