public static void normalize ( GrayF32 image , float mean , float stdev ) { for ( int y = 0 ; y < image . height ; y ++ ) { int index = image . startIndex + y * image . stride ; int end = index + image . width ; while ( index < end ) { image . data [ index ] = ( image . data [ index ] - mean ) / stdev ; index ++ ; } } }
Normalizes a gray scale image by first subtracting the mean then dividing by stdev .