fcn histogram(image){ hist:=List.createLong(256,0); // array[256] of zero image.data.howza(0).pump(Void,'wrap(c){ hist[c]+=1 }); // byte by byte loop hist; } fcn histogramMedian(hist){ from,to:=0,(2).pow(8) - 1; // 16 bits of luminance left,right:=hist[from],hist[to]; while(from!=to){ if(left