google earth engine随缘学习(九)霍夫变换(Hough Transform)

首先介绍一下霍夫变换——原博主超链接https://blog.csdn.net/fishmemory/article/details/51496190在这里插入图片描述
霍夫变换可以提取图像的几何特征,监测直线甚至监测圆或椭圆等任意形状物体。
官方示例代码:
/ An example finding linear features using the HoughTransform.

// Load an image and compute NDVI.
var image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_033032_20170719');
var ndvi = image.normalizedDifference(['B5', 'B4']);

// Apply a Canny edge detector.
var canny = ee.Algorithms.CannyEdgeDetector({
  image: ndvi,
  threshold: 0.4
}).multiply(255);

// Apply the Hough transform.
var h = ee.Algorithms.HoughTransform({
  image: canny,
  gridSize: 256,
  inputThreshold: 50,
  lineThreshold: 100
});

// Display.
Map.setCenter(-103.80140, 40.21729, 13);
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'], max: 0.3}, 'source_image');
Map.addLayer(canny.updateMask(canny), {min: 0, max: 1, palette: 'blue'}, 'canny');
Map.addLayer(h.updateMask(h), {min: 0, max: 1, palette: 'red'}, 'hough');

先利用CannyEdgeDetector函数提取NDVI图像的边界,然后利用霍夫变换提取其直线特征。
效果如下(蓝色线为边界,红色线为霍夫变换结果):

在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值