protected int computeHistogramBin ( float value [ ] ) { int indexHistogram = 0 ; int binStride = 1 ; for ( int bandIndex = 0 ; bandIndex < value . length ; bandIndex ++ ) { int bin = ( int ) ( numBins * value [ bandIndex ] / maxPixelValue ) ; indexHistogram += bin * binStride ; binStride *= numBins ; } return indexHistogram ; }
Given the value of a pixel compute which bin in the histogram it belongs in