1

I am trying to compare two histograms using compareHist() function, but I can't manage to insert the right comparing method. In the documentation the options are

CV_COMP_CORREL Correlation
CV_COMP_CHISQR Chi-Square
CV_COMP_CHISQR_ALT Alternative Chi-Square
CV_COMP_INTERSECT Intersection
CV_COMP_BHATTACHARYYA Bhattacharyya distance
CV_COMP_HELLINGER Synonym for CV_COMP_BHATTACHARYYA
CV_COMP_KL_DIV Kullback-Leibler divergence

each can be called with cv2.cv. I am using openCv 3.2.0 and I get the error

    d = cv2.compareHist(query_hist, input_hist, cv2.CV_COMP_HELLINGER)
 AttributeError: 'module' object has no attribute 'CV_COMP_HELLINGER'

I have tried both cv2.cv.CV_COMP_HELLINGER and cv2.CV_COMP_HELLINGER but the error is the same

Argentina
  • 1,071
  • 5
  • 16
  • 30

1 Answers1

4

Use cv2.HISTCMP_HELLINGER.


The name has changed in OpenCV 3. You can find the new names in the documentation:

HISTCMP_CORREL
HISTCMP_CHISQR
HISTCMP_INTERSECT
HISTCMP_BHATTACHARYYA
HISTCMP_HELLINGER       
HISTCMP_CHISQR_ALT
HISTCMP_KL_DIV
Miki
  • 40,887
  • 13
  • 123
  • 202