公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.Image.reduceNeighborhood
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
将给定的归约函数应用于每个像素周围的邻域(由给定的内核确定)。如果精简器的输入源只有一个,则会单独应用于集合的每个波段;否则,其输入源的数量必须与输入源图像的波段数量相同。
化简器输出名称决定了输出波段的名称:具有多个输入的化简器将直接使用输出名称,而具有单个输入的化简器将在输出名称前添加输入波段名称作为前缀(例如,'10_mean'、'20_mean')。
具有加权输入的归约器的输入权重可以基于输入掩码、内核值或这两者中较小的值。
用法 | 返回 |
---|
Image.reduceNeighborhood(reducer, kernel, inputWeight, skipMasked, optimization) | 图片 |
参数 | 类型 | 详细信息 |
---|
此:image | 图片 | 输入图片。 |
reducer | 缩减器 | 要应用于邻域内像素的精简器。 |
kernel | 内核 | 用于定义邻域的内核。 |
inputWeight | 字符串,默认值:“kernel” | 可以是“mask”“kernel”或“min”。 |
skipMasked | 布尔值,默认值:true | 如果相应的输入像素被遮盖,则遮盖输出像素。 |
optimization | 字符串,默认值:null | 优化策略。选项包括“boxcar”和“window”。“箱式”方法是一种快速计算数量、总和或平均值的方法。它需要同质内核、单输入归约器以及 MASK、KERNEL 或无加权。“window”方法使用滚动窗口,并且具有与“boxcar”相同的要求,但可以使用任何单个输入缩减器。这两种方法都需要大量额外的内存。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\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. |"]]