1. A method, comprising: performing by one or more computers: generating a histogram for a region of an input image, wherein the histogram comprises a plurality of bucket values, each dependent on values of pixels in the region; generating an array comprising a plurality of array values, each associated with one or more of the plurality of bucket values, and each dependent on the plurality of bucket values; merging the histogram with a second histogram to produce a third histogram, wherein the second histogram comprises a second plurality of bucket values, each bucket value in the second plurality of bucket values dependent on values of pixels in a second region in a same way as corresponding bucket values in the histogram, wherein said merging comprises: for each non-zero array value, merging at least one of the one or more of the plurality of bucket values associated with the non-zero array value with a corresponding bucket value of the second histogram to generate a third bucket value for a corresponding bucket of the third histogram; for each array value of zero, including bucket values of the second plurality of bucket values corresponding to the one or more of the plurality of bucket values associated with the array value of zero in buckets of the third histogram; and rendering a second image dependent on bucket values in the third histogram.