Revision 12176 trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/convolution/ConvolutionDoubleFilter.java

View differences:

ConvolutionDoubleFilter.java
75 75
	public void process(int col, int line) {
76 76
		
77 77
		int lado= kernel.getLado();
78
		int semiLado = (lado - 1) >> 1;
78 79
		double ventana[][]= new double[lado][lado];
79 80
		double resultConvolution=0;
80
		for (int i = 0; i < raster.getBandCount(); i++) {	
81
			if((col>lado)&& (line>lado)&& (line<raster.getHeight()-lado) && col<raster.getWidth()-lado){
82
				for(int s=line; s< line+lado; s++)
83
					for(int r=col; r<col+lado; r++)
84
						 ventana[s-line][r-col]= raster.getElemDouble(s,r,i);
81
		for (int band = 0; band < raster.getBandCount(); band++) {	
82
			if ((col - semiLado >= 0) && (line - semiLado >= 0) && (col + semiLado < width) && (line + semiLado < height)){
83
				for (int j = -semiLado; j <= semiLado; j++)
84
					for (int i = -semiLado; i <= semiLado; i++)
85
						ventana[i + semiLado][j + semiLado] = raster.getElemDouble(line + j, col + i, band);
85 86
				Kernel Kventana= new Kernel(ventana);
86 87
				resultConvolution=(double)kernel.convolution(Kventana);
87
				rasterResult.setElem(line, col, i,(double)resultConvolution);	
88
				rasterResult.setElem(line, col, band,(double)resultConvolution);	
88 89
			}
89
			else rasterResult.setElem(line, col, i,(double)raster.getElemDouble(line,col,i));
90
		}
90
			else rasterResult.setElem(line, col,band,(double)raster.getElemDouble(line,col,band));
91
		}	
91 92
	}
92 93
	/**
93 94
	 * @return  tipo de dato del buffer de entrada

Also available in: Unified diff