formula for comparing histograms using the Chi-Squared method is incorrect (Patch #1263)


Added by Nicu Stiurca over 13 years ago. Updated almost 13 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:imgproc, video
Target version:2.4.0
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

One of the input histograms (say H1) should be denoted the histogram of expected values (henceforth, E), and the other (H2) should be denoted the histogram of observed values (henceforth, O). Then, the numerator of the summation terms becomes
(O(I) - E(I))^2

(numerically the same, but renamed variables), while the denominator SHOULD BE simply
E(I)
NOT
E(I) + O(I)

See, eg, http://en.wikipedia.org/wiki/Pearson%27s_chi-square_test#Calculating_the_test-statistic

Trivial patch included. Note: it may break unit tests if the tests used the wrong formula for the expected value.


histogram.cpp.patch - patch to fix chi squared formula (717 Bytes) Nicu Stiurca, 2011-07-28 04:03 am


Associated revisions

Revision befa9b31
Added by Vadim Pisarevsky almost 13 years ago

fixed chi-square test, ticket #1263

Revision bcba3fc6
Added by Roman Donchenko over 11 years ago

Merge pull request #1263 from abidrahmank:pyCLAHE_24

History

Updated by Kirill Kornyakov about 13 years ago

  • Tracker changed from Bug to Patch

Updated by Alexander Shishkov almost 13 years ago

  • Target version deleted ()

Updated by Alexander Shishkov almost 13 years ago

  • Assignee deleted (Vadim Pisarevsky)

Updated by Vadim Pisarevsky almost 13 years ago

thanks! updated the code, tests and docs (r7626)

  • Status changed from Open to Done
  • Assignee set to Vadim Pisarevsky

Updated by Alexander Shishkov almost 13 years ago

  • Target version set to 2.4.0

Also available in: Atom PDF