total[band] /= weight; output.set(x,y, total );
public static void vertical(Kernel1D_F64 kernel, InterleavedF64 input, InterleavedF64 output ) { final int offset = kernel.getOffset(); final int width = input.getWidth(); final int height = input.getHeight(); final int numBands = input.getNumBands(); final double[] pixel = new double[ numBands ]; final double[] total = new double[ numBands ]; for (int y = 0; y < height; y++) { for( int x = 0; x < width; x++ ) { Arrays.fill(total,0); double weight = 0; int startY = y - offset; int endY = startY + kernel.getWidth(); if( startY < 0 ) startY = 0; if( endY > height ) endY = height; for( int i = startY; i < endY; i++ ) { double v = kernel.get(i-y+offset); input.get(x,i, pixel); for (int band = 0; band < numBands; band++) { total[band] += pixel[band]*v; } weight += v; } for (int band = 0; band < numBands; band++) { total[band] /= weight; } output.set(x,y, total); } } }
total[band] /= weight; output.set(x,y, total);