Fix histogram calculation in equalizeHist

issue #2678
Merge pull request #284 from taka-no-me:fix_equalize_hist_2678