Google Earth Engine(GEE)——地物大小的筛选

形态学就是确定影像地物的显示大小和方式, focal_max()focal_min()focal_median(),和 focal_mode()实例的方法Image类。(这些是更通用的快捷方式reduceNeighborhood(),它可以将内核中的像素输入到任何具有数字输出的筛选器中筛选。形态算子可用于执行诸如腐蚀、膨胀、打开和关闭之类的操作。例如,使用focal_min()后跟focal_max()确定地物的大小显示。

大于等于0.2时候的影像

 半径设置为1的时候的影像

  半径设置为2的时候的影像

ee.Kernel.circle(radius, unitsnormalizemagnitude)

(半径,单位,归一化,幅度)

Generates a circle-shaped boolean kernel.

生成圆形布尔内核。

Arguments:

radius (Float):

The radius of the kernel to generate.

units (String, default: "pixels"):

The system of measurement for the kernel ('pixels' or 'meters'). If the kernel is specified in meters, it will resize when the zoom-level is changed.

内核的测量系统(“像素”或“米”)。如果内核以米为单位指定,则在更改缩放级别时会调整大小。

normalize (Boolean, default: true):

Normalize the kernel values to sum to 1.

将内核值归一化为总和为 1。

magnitude (Float, default: 1):

Scale each value by this amount.

按此量缩放每个值

Returns: Kernel

代码:

// 加载影像选择近红外波段并且按照大于0.2的标准进行筛选
var image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318')
            .select(4).gt(0.2);
Map.setCenter(-122.1899, 37.5010, 13);
Map.addLayer(image, {}, 'NIR threshold');

// 定义一个像素的内核,半径为1
var kernel = ee.Kernel.circle({radius: 2});

// 加载影像
var opened = image
             .focal_min({kernel: kernel, iterations: 2})
             .focal_max({kernel: kernel, iterations: 2});
Map.addLayer(opened, {}, 'opened');

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

此星光明

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值