【问题标题】:How to detect trees from imagery using MATLAB?如何使用 MATLAB 从图像中检测树木?
【发布时间】:2013-12-27 11:31:40
【问题描述】:

我想标记图像中存在的树木。我尝试了许多基于颜色的分割方法,如 RGB 矢量空间和 HSI 颜色空间、Lab* 颜色空间、分水岭分割、NDVI 方法,但大部分树区域都丢失了。

有人知道更多颜色检测(或)分割程序吗?

我只需要在 MATLAB 中开发算法..

【问题讨论】:

标签: matlab design-patterns detection


【解决方案1】:

从遥感数据(如卫星或航空图像)中提取树木的基本方法是计算归一化植被指数 (NDVI),然后对 NDVI 进行阈值处理。

为了说明,请考虑以下4-band color infrared image(警告 160MB 下载)。 NDVI 提供了一种在 -1:1 范围内表达活的绿色植被强度的方法。通常这些值会被拉伸(如附加脚本中所示)以填充图像位深度的整个范围(例如 0-255)。计算出 NDVI 后,您可以通过基本上说“仅保留像素值 > X”来对图像进行阈值处理。输出为二值图像,可用于分析单位面积的树冠覆盖率等指标。

file = 'D:\path\to\doi1m2011_41111h4nw_usda.tif';
[I R] = geotiffread(file);
outputdir = 'D:\output\'

%% Calculate NDVI
NIR = im2single(I(:,:,4));
red = im2single(I(:,:,1));

ndvi = (NIR - red) ./ (NIR + red);
double(ndvi);
imshow(ndvi,'DisplayRange',[-1 1]);

%% Stretch to 0-255
ndvi = floor((ndvi + 1) * 128); % [-1 1] -> [0 256]
ndvi(ndvi < 0) = 0;             
ndvi(ndvi > 255) = 255;         
ndvi = uint8(ndvi);             

%% Threshold the NDVI
threshold = 100  % You may need to experiment with this value
i = (ndvi > threshold);
imshow(i)

%% Write output to disk
tiffdata = geotiffinfo(file);
outfilename = [outputdir 'threshold_image' '.tif'];  
geotiffwrite(outfilename, i, R, 'GeoKeyDirectoryTag', tiffdata.GeoTIFFTags.GeoKeyDirectoryTag)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-25
    • 2015-02-04
    • 1970-01-01
    • 2015-12-24
    • 2016-10-07
    • 1970-01-01
    相关资源
    最近更新 更多