private void updateWeights ( float [ ] histogram ) { for ( int j = 0 ; j < weightHistogram . length ; j ++ ) { float h = histogram [ j ] ; if ( h != 0 ) { weightHistogram [ j ] = ( float ) Math . sqrt ( keyHistogram [ j ] / h ) ; } } }
Update the weights for each element in the histogram . Weights are used to favor colors which are less than expected .