public static void equalize ( int histogram [ ] , int transform [ ] ) { int sum = 0 ; for ( int i = 0 ; i < histogram . length ; i ++ ) { transform [ i ] = sum += histogram [ i ] ; } int maxValue = histogram . length - 1 ; for ( int i = 0 ; i < histogram . length ; i ++ ) { transform [ i ] = ( transform [ i ] * maxValue ) / sum ; } }
Computes a transformation table which will equalize the provided histogram . An equalized histogram spreads the weight across the whole spectrum of values . Often used to make dim images easier for people to see .