公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
ee.Image.reduceConnectedComponents
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將縮減器套用至每個「物件」內的所有像素。如果像素已連線 (8 向) 且「標籤」頻帶中的值相同,系統就會將像素視為屬於物件。標籤帶僅用於識別連線狀態,其餘則做為縮減函式的輸入內容。
用量 | 傳回 |
---|
Image.reduceConnectedComponents(reducer, labelBand, maxSize) | 圖片 |
引數 | 類型 | 詳細資料 |
---|
這個:image | 圖片 | 輸入圖片。 |
reducer | 縮減函式 | 要套用至所連線元件內像素的縮減函式。 |
labelBand | 字串,預設值為空值 | 用於偵測連線狀態的頻段名稱。如未指定,則會使用第一個頻帶。 |
maxSize | 整數,預設值為 256 | 彙整值時要考量的鄰域大小。如果物件的水平或垂直尺寸大於 maxSize,系統就會遮蓋物件,因為物件的部分可能位於鄰近區域外。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eReduces pixel values within connected regions (objects) of an image based on a user-provided reducer function.\u003c/p\u003e\n"],["\u003cp\u003eObjects are identified by contiguous pixels sharing the same value in a specified label band (defaults to the first band if not provided).\u003c/p\u003e\n"],["\u003cp\u003eThe reducer function receives all image bands except the label band as input and aggregates pixel values within each object.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003emaxSize\u003c/code\u003e parameter limits the size of objects considered for reduction, masking larger objects to avoid edge effects.\u003c/p\u003e\n"]]],[],null,["# ee.Image.reduceConnectedComponents\n\nApplies a reducer to all of the pixels inside of each 'object'. Pixels are considered to belong to an object if they are connected (8-way) and have the same value in the 'label' band. The label band is only used to identify the connectedness; the rest are provided as inputs to the reducer.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-------------------------------------------------------------------------|---------|\n| Image.reduceConnectedComponents`(reducer, `*labelBand* `, `*maxSize*`)` | 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 connected component. |\n| `labelBand` | String, default: null | The name of the band to use to detect connectedness. If unspecified, the first band is used. |\n| `maxSize` | Integer, default: 256 | Size of the neighborhood to consider when aggregating values. Any objects larger than maxSize in either the horizontal or vertical dimension will be masked, since portions of the object might be outside of the neighborhood. |"]]