public static void flipVertical ( GrayS32 input ) { int h2 = input . height / 2 ; for ( int y = 0 ; y < h2 ; y ++ ) { int index1 = input . getStartIndex ( ) + y * input . getStride ( ) ; int index2 = input . getStartIndex ( ) + ( input . height - y - 1 ) * input . getStride ( ) ; int end = index1 + input . width ; while ( index1 < end ) { int tmp = input . data [ index1 ] ; input . data [ index1 ++ ] = input . data [ index2 ] ; input . data [ index2 ++ ] = ( int ) tmp ; } } }
Flips the image from top to bottom