前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >GEE基础学习——用HoughTransform自动识别线性要素!

GEE基础学习——用HoughTransform自动识别线性要素!

作者头像
此星光明
发布2024-02-01 19:47:16
发布2024-02-01 19:47:16
10900
代码可运行
举报
运行总次数:0
代码可运行

很多时候,我们为了选要素需要手动进行,但是目前有GOOGLE上已有了HoughTransform算法,让我们看图说话:

这是通过该算法实现的线性识别

下面这张图是通过边缘识别Canny的效果:

再来看看两者叠加的效果:

整体上看线性识别效果要比canny边界识别的效果差一些!

代码展示:

代码语言:javascript
代码运行次数:0
复制
// 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');

这两种方法根据自己的研究分别试试,最后看效果再决定!

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-02-01,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档