protected static void innerAverageFlow( ImageFlow flow , ImageFlow averageFlow ) {

		int endX = flow.width-1;
		int endY = flow.height-1;

		for( int y = 1; y < endY; y++ ) {
			int index = flow.width*y + 1;
			for( int x = 1; x < endX; x++ , index++) {
				ImageFlow.D average = averageFlow.data[index];

				ImageFlow.D f0 = flow.data[index-1];
				ImageFlow.D f1 = flow.data[index+1];
				ImageFlow.D f2 = flow.data[index-flow.width];
				ImageFlow.D f3 = flow.data[index+flow.width];

				ImageFlow.D f4 = flow.data[index-1-flow.width];
				ImageFlow.D f5 = flow.data[index+1-flow.width];
				ImageFlow.D f6 = flow.data[index-1+flow.width];
				ImageFlow.D f7 = flow.data[index+1+flow.width];

				average.x = 0.1666667f*(f0.x + f1.x + f2.x + f3.x) + 0.08333333f*(f4.x + f5.x + f6.x + f7.x);
				average.y = 0.1666667f*(f0.y + f1.y + f2.y + f3.y) + 0.08333333f*(f4.y + f5.y + f6.y + f7.y);
			}
		}
	}
protected static void innerAverageFlow ( ImageFlow flow , ImageFlow averageFlow ) { int endX = flow . width - 1 ; int endY = flow . height - 1 ; for ( int y = 1 ; y < endY ; y ++ ) { int index = flow . width * y + 1 ; for ( int x = 1 ; x < endX ; x ++ , index ++ ) { ImageFlow . D average = averageFlow . data [ index ] ; ImageFlow . D f0 = flow . data [ index - 1 ] ; ImageFlow . D f1 = flow . data [ index + 1 ] ; ImageFlow . D f2 = flow . data [ index - flow . width ] ; ImageFlow . D f3 = flow . data [ index + flow . width ] ; ImageFlow . D f4 = flow . data [ index - 1 - flow . width ] ; ImageFlow . D f5 = flow . data [ index + 1 - flow . width ] ; ImageFlow . D f6 = flow . data [ index - 1 + flow . width ] ; ImageFlow . D f7 = flow . data [ index + 1 + flow . width ] ; average . x = 0.1666667f * ( f0 . x + f1 . x + f2 . x + f3 . x ) + 0.08333333f * ( f4 . x + f5 . x + f6 . x + f7 . x ) ; average . y = 0.1666667f * ( f0 . y + f1 . y + f2 . y + f3 . y ) + 0.08333333f * ( f4 . y + f5 . y + f6 . y + f7 . y ) ; } } }
Computes average flow using an 8-connect neighborhood for the inner image