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