公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.Image.neighborhoodToArray
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
将标量图像中每个像素的邻域转换为二维数组。输出数组的轴 0 和轴 1 分别对应于图片的 Y 轴和 X 轴。输出图片的波段数与输入图片的波段数相同;每个输出波段的掩码与相应输入波段的掩码相同。输入图像的覆盖区和元数据会保留。
用法 | 返回 |
---|
Image.neighborhoodToArray(kernel, defaultValue) | 图片 |
参数 | 类型 | 详细信息 |
---|
此:image | 图片 | 要从中获取像素的图片;必须是标量值。 |
kernel | 内核 | 用于指定邻域形状的内核。仅支持固定大小的正方形和矩形内核。系统会忽略权重,仅使用内核的形状。 |
defaultValue | 浮点数,默认值:0 | 在输出数组中用于替换输入中无效(被遮盖)像素的值。如果频段类型为整数,则会舍弃此值的小数部分;在任何情况下,该值都会被限制在频段的值范围内。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eTransforms a scalar image into a 2D array representation of pixel neighborhoods.\u003c/p\u003e\n"],["\u003cp\u003eOutput array dimensions align with the image's Y and X axes, maintaining the input's band count and mask.\u003c/p\u003e\n"],["\u003cp\u003eUtilizes a kernel to define neighborhood shape, with optional defaultValue for handling masked pixels.\u003c/p\u003e\n"],["\u003cp\u003ePreserves original image metadata and footprint for seamless integration into workflows.\u003c/p\u003e\n"]]],["Transforms a scalar image by converting each pixel's neighborhood into a 2D array. The output array's axes 0 and 1 correspond to the image's Y and X axes, respectively. The method uses a `kernel` to define the neighborhood's shape (fixed, square, or rectangle). Invalid pixels within the input are replaced using a `defaultValue`. The input image's footprint, metadata, and mask are retained, but kernel weights are not considered. The method returns a new `Image`.\n"],null,["# ee.Image.neighborhoodToArray\n\nTurns the neighborhood of each pixel in a scalar image into a 2D array. Axes 0 and 1 of the output array correspond to Y and X axes of the image, respectively. The output image will have as many bands as the input; each output band has the same mask as the corresponding input band. The footprint and metadata of the input image are preserved.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-------------------------------------------------------|---------|\n| Image.neighborhoodToArray`(kernel, `*defaultValue*`)` | Image |\n\n| Argument | Type | Details |\n|----------------|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `image` | Image | The image to get pixels from; must be scalar-valued. |\n| `kernel` | Kernel | The kernel specifying the shape of the neighborhood. Only fixed, square and rectangle kernels are supported. Weights are ignored; only the shape of the kernel is used. |\n| `defaultValue` | Float, default: 0 | The value to use in the output arrays to replace the invalid (masked) pixels of the input. If the band type is integral, the fractional part of this value is discarded; in all cases, the value is clamped to the value range of the band. |"]]