Earth Engine 推出了
非商业配额层级,以保护共享计算资源并确保为所有人提供可靠的性能。非商业项目默认使用 Community
层级,但您可以随时更改项目的层级。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
形态学运算
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Earth Engine 将形态学运算实现为焦点运算,具体而言,就是 Image 类中的 focalMax()、focalMin()、focalMedian() 和 focalMode() 实例方法。(这些是更通用的 reduceNeighborhood() 的快捷方式,可将内核中的像素输入到具有数值输出的任何 reducer。如需详细了解如何减少邻区,请参阅此页面。形态学运算符非常适合执行侵蚀、膨胀、开运算和闭运算等操作。例如,如需执行打开操作,请使用 focalMin() 后跟 focalMax():
Code Editor (JavaScript)
// Load a Landsat 8 image, select the NIR band, threshold, display.
var image = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318')
.select(4).gt(0.2);
Map.setCenter(-122.1899, 37.5010, 13);
Map.addLayer(image, {}, 'NIR threshold');
// Define a kernel.
var kernel = ee.Kernel.circle({radius: 1});
// Perform an erosion followed by a dilation, display.
var opened = image
.focalMin({kernel: kernel, iterations: 2})
.focalMax({kernel: kernel, iterations: 2});
Map.addLayer(opened, {}, 'opened');
请注意,在上例中,系统会向形态学运算符提供核参数。核的非零元素所覆盖的像素会用于计算。iterations 参数表示要应用运算符的次数。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],["Earth Engine's `Image` class provides `focalMax()`, `focalMin()`, `focalMedian()`, and `focalMode()` for morphological operations like erosion, dilation, opening, and closing. These operations use a kernel to define the neighborhood of pixels. For example, the opening operation is achieved by applying `focalMin()` then `focalMax()`. A kernel argument defines the area for computation, and the iterations argument specifies the number of operator applications. The provided code demonstrates the opening operation on a Landsat 8 image using a circular kernel.\n"]]