Counting Pixels with Histograms