Anuncio: Todos los proyectos no comerciales registrados para usar Earth Engine antes del
15 de abril de 2025 deben
verificar su elegibilidad no comercial para mantener el acceso a Earth Engine.
ee.Image.reduceNeighborhood
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Aplica el reductor determinado a la vecindad alrededor de cada píxel, según lo determina el kernel determinado. Si el reductor tiene una sola entrada, se aplicará por separado a cada banda de la colección; de lo contrario, debe tener la misma cantidad de entradas que bandas tiene la imagen de entrada.
Los nombres de salida del reductor determinan los nombres de las bandas de salida: los reductores con varias entradas usarán los nombres de salida directamente, mientras que los reductores con una sola entrada antepondrán el nombre de la banda de entrada al nombre de salida (p.ej., "10_mean", "20_mean").
Los reductores con entradas ponderadas pueden tener el peso de entrada basado en la máscara de entrada, el valor del kernel o el menor de esos dos.
Uso | Muestra |
---|
Image.reduceNeighborhood(reducer, kernel, inputWeight, skipMasked, optimization) | Imagen |
Argumento | Tipo | Detalles |
---|
esta: image | Imagen | Es la imagen de entrada. |
reducer | Reductor | Es el reductor que se aplica a los píxeles dentro de la vecindad. |
kernel | Kernel | Es el kernel que define la vecindad. |
inputWeight | Cadena, valor predeterminado: "kernel" | Puede ser "mask", "kernel" o "min". |
skipMasked | Booleano, valor predeterminado: verdadero | Enmascara los píxeles de salida si el píxel de entrada correspondiente está enmascarado. |
optimization | Cadena, valor predeterminado: nulo | Es la estrategia de optimización. Las opciones son "boxcar" y "window". El método de "caja de vagón" es un método rápido para calcular el recuento, la suma o la media. Requiere un kernel homogéneo, un reductor de una sola entrada y MASK, KERNEL o ningún factor de ponderación. El método "window" usa una ventana en ejecución y tiene los mismos requisitos que "boxcar", pero puede usar cualquier reductor de entrada único. Ambos métodos requieren una cantidad considerable de memoria adicional. |
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 2025-07-26 (UTC)"],[[["\u003cp\u003eApplies a given reducer function to the neighborhood of each pixel, defined by a kernel.\u003c/p\u003e\n"],["\u003cp\u003eOutput band names are determined by the reducer's output names, prefixed with the input band name for single-input reducers.\u003c/p\u003e\n"],["\u003cp\u003eInput weight for reducers can be based on the mask, kernel value, or the minimum of the two.\u003c/p\u003e\n"],["\u003cp\u003eOffers optimization strategies like 'boxcar' and 'window' for specific reducer and kernel types to improve performance.\u003c/p\u003e\n"],["\u003cp\u003eAllows skipping computation on masked pixels for efficiency.\u003c/p\u003e\n"]]],["This operation applies a reducer to pixel neighborhoods defined by a kernel. The reducer can have single or multiple inputs, with output band names determined accordingly. Weighted inputs are supported based on the input mask, kernel value, or their minimum. Options are available to skip masked pixels and optimize the process. The `Image.reduceNeighborhood` function takes a reducer, kernel, input weight, skip masked option, and an optimization method, returning a new image.\n"],null,["# ee.Image.reduceNeighborhood\n\nApplies the given reducer to the neighborhood around each pixel, as determined by the given kernel. If the reducer has a single input, it will be applied separately to each band of the collection; otherwise it must have the same number of inputs as the input image has bands.\n\n\u003cbr /\u003e\n\nThe reducer output names determine the names of the output bands: reducers with multiple inputs will use the output names directly, while reducers with a single input will prefix the output name with the input band name (e.g., '10_mean', '20_mean').\n\nReducers with weighted inputs can have the input weight based on the input mask, the kernel value, or the smaller of those two.\n\n| Usage | Returns |\n|--------------------------------------------------------------------------------------------------|---------|\n| Image.reduceNeighborhood`(reducer, kernel, `*inputWeight* `, `*skipMasked* `, `*optimization*`)` | Image |\n\n| Argument | Type | Details |\n|----------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `image` | Image | The input image. |\n| `reducer` | Reducer | The reducer to apply to pixels within the neighborhood. |\n| `kernel` | Kernel | The kernel defining the neighborhood. |\n| `inputWeight` | String, default: \"kernel\" | One of 'mask', 'kernel', or 'min'. |\n| `skipMasked` | Boolean, default: true | Mask output pixels if the corresponding input pixel is masked. |\n| `optimization` | String, default: null | Optimization strategy. Options are 'boxcar' and 'window'. The 'boxcar' method is a fast method for computing count, sum or mean. It requires a homogeneous kernel, a single-input reducer and either MASK, KERNEL or no weighting. The 'window' method uses a running window, and has the same requirements as 'boxcar', but can use any single input reducer. Both methods require considerable additional memory. |"]]