公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.Image.reduceConnectedComponents
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
将化简函数应用于每个“对象”内的所有像素。如果像素彼此连接(8 向连接)并且在“标签”波段中具有相同的值,则认为这些像素属于同一对象。标签频段仅用于标识连通性;其余频段作为输入提供给化简器。
用法 | 返回 |
---|
Image.reduceConnectedComponents(reducer, labelBand, maxSize) | 图片 |
参数 | 类型 | 详细信息 |
---|
此:image | 图片 | 输入图片。 |
reducer | 缩减器 | 要应用于连接组件内像素的精简器。 |
labelBand | 字符串,默认值:null | 用于检测连接性的频段的名称。如果未指定,则使用第一个频段。 |
maxSize | 整数,默认值:256 | 在汇总值时要考虑的邻域大小。如果任何对象在水平或垂直维度上大于 maxSize,系统都会遮盖该对象,因为对象的部分内容可能位于邻域之外。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):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. |"]]