public static void histogram ( GrayU8 image , int maxPixelValue , TupleDesc_F64 histogram ) { int numBins = histogram . size ( ) ; int divisor = maxPixelValue + 1 ; histogram . fill ( 0 ) ; for ( int y = 0 ; y < image . height ; y ++ ) { int index = image . startIndex + y * image . stride ; for ( int x = 0 ; x < image . width ; x ++ , index ++ ) { int value = image . data [ index ] & 0xFF ; int bin = numBins * value / divisor ; histogram . value [ bin ] ++ ; } } }
Computes a single - band normalized histogram from an integer image ..