Fixed pixel reference bug in the calculation of the histogram.