公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
ee.Image.reduceNeighborhood
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將指定縮減器套用至每個像素周圍的鄰域,如指定核心所決定。如果縮減函式只有一個輸入,系統會分別套用至集合的每個波段;否則,輸入數量必須與輸入圖片的波段數量相同。
化簡器輸出名稱會決定輸出波段的名稱:有多個輸入內容的化簡器會直接使用輸出名稱,而只有一個輸入內容的化簡器則會在輸出名稱前加上輸入波段名稱 (例如 '10_mean', '20_mean')。
如果縮減函式具有加權輸入,則輸入權重可根據輸入遮罩、核心值或兩者中較小的值。
用量 | 傳回 |
---|
Image.reduceNeighborhood(reducer, kernel, inputWeight, skipMasked, optimization) | 圖片 |
引數 | 類型 | 詳細資料 |
---|
這個:image | 圖片 | 輸入圖片。 |
reducer | 縮減函式 | 要套用至鄰近像素的縮減器。 |
kernel | 核心 | 定義鄰域的 Kernel。 |
inputWeight | 字串,預設值為「kernel」 | 可以是「mask」、「kernel」或「min」。 |
skipMasked | 布林值,預設值為 true | 如果對應的輸入像素已遮蓋,則遮蓋輸出像素。 |
optimization | 字串,預設值為空值 | 最佳化策略。選項包括「boxcar」和「window」。「boxcar」方法是計算計數、總和或平均值的快速方法。這項作業需要同質核心、單一輸入縮減器,以及 MASK、KERNEL 或無加權。「視窗」方法使用執行中的視窗,與「boxcar」有相同需求,但可使用任何單一輸入縮減器。這兩種方法都需要大量額外記憶體。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間: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. |"]]