Revision 12176 trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/convolution/ConvolutionFloatFilter.java
ConvolutionFloatFilter.java | ||
---|---|---|
72 | 72 |
/** Aplicacion del filtro para el pixel de la posicion line, col */ |
73 | 73 |
public void process(int col, int line) { |
74 | 74 |
|
75 |
double ventana[][]= new double[ladoVentana][ladoVentana]; |
|
75 |
int lado= kernel.getLado(); |
|
76 |
int semiLado = (lado - 1) >> 1; |
|
77 |
double ventana[][]= new double[lado][lado]; |
|
76 | 78 |
float resultConvolution=0; |
77 |
for (int i = 0; i < raster.getBandCount(); i++) {
|
|
78 |
if((col>ladoVentana)&& (line>ladoVentana)&& (line<raster.getHeight()-ladoVentana) && col<raster.getWidth()-ladoVentana){
|
|
79 |
for(int s=line; s< line+ladoVentana; s++)
|
|
80 |
for(int r=col; r<col+ladoVentana; r++)
|
|
81 |
ventana[s-line][r-col]= raster.getElemFloat(s,r,i);
|
|
79 |
for (int band = 0; band < raster.getBandCount(); band++) {
|
|
80 |
if ((col - semiLado >= 0) && (line - semiLado >= 0) && (col + semiLado < width) && (line + semiLado < height)){
|
|
81 |
for (int j = -semiLado; j <= semiLado; j++)
|
|
82 |
for (int i = -semiLado; i <= semiLado; i++)
|
|
83 |
ventana[i + semiLado][j + semiLado] = raster.getElemFloat(line + j, col + i, band);;
|
|
82 | 84 |
Kernel Kventana= new Kernel(ventana); |
83 | 85 |
resultConvolution=(float)kernel.convolution(Kventana); |
84 |
rasterResult.setElem(line, col, i,(float)resultConvolution); |
|
85 |
|
|
86 |
rasterResult.setElem(line, col, band,(float)resultConvolution); |
|
86 | 87 |
} |
87 |
else rasterResult.setElem(line, col, i,(float)raster.getElemFloat(line,col,i));
|
|
88 |
} |
|
88 |
else rasterResult.setElem(line, col,band,(float)raster.getElemFloat(line,col,band));
|
|
89 |
}
|
|
89 | 90 |
|
90 | 91 |
} |
91 | 92 |
|
Also available in: Unified diff