Google Earth Engine---形态操作

形态操作Morphological Operations

GEE改进了形态操作成为焦点操作(focal operations),具体为Image类的focal_max(),focal_min(),focal_median(),and focal_mode()实例方法。(这些是更加通用的reduceneighborhood()方法的快捷版,reduceneighborhood()可以使kernel里的每一个像素进入到任何reducer得到一个数字输出。参考该页获取更多在reducing neighborhoods方面的信息。)形态操作在执行侵蚀erosion、膨胀dilation、打开opending和关闭closing等方面是有用的。例如,执行一个opending操作,使用focal_min()跟随一个focal_max():

// Load a Landsat 8 image, select the NIR band, threshold, display.
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');

// Define a kernel.
var kernel = ee.Kernel.circle({radius: 1});

// Perform an erosion followed by a dilation, display.
var opened = image
             .focal_min({kernel: kernel, iterations: 2})
             .focal_max({kernel: kernel, iterations: 2});
Map.addLayer(opened, {}, 'opened');
    

注意在前面的例子里,提供了一个kernel参数给形态操作。kernel非零元素对应的像素值被用来计算。迭代参数表明应用到操作的次数。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值