1. 前提
之前我写过一篇使用Savitzky-Golay处理遥感数据,获取地面物候信息的MATLAB代码:Python地理数据处理 十七:植被物候提取和分析(Savitzky-Golay)
但是发现存在一些问题:对物候开始期和物候结束期的阈值设定都为相同值,但是有些研究中,需要根据不同的环境条件,设置不同的物候阈值,如下:
![在这里插入图片描述](https://img-blog.csdnimg.cn/7e7a7d5a26a74516ae3550223a03afcb.png)
动态阈值法模型如下所示:
![在这里插入图片描述](https://img-blog.csdnimg.cn/8df2a10c4fba440a9d0b9fbb3dbc88cf.png)
2. MATLAB代码
SOS阈值设置为0.2,EOS阈值设置为0.5:
% 读取文件夹下的子文件夹列表
folderPath = 'D:\dataset\phenology';
subFolders = dir(folderPath);
subFolders = subFolders([subFolders.isdir]);
subFolders = subFolders(3:end); % 排除"."和".."文件夹
% 循环处理每个子文件夹
for i = 1:length(subFolders)
fprintf('d=%d\n', i)
subFolder = subFolders(i).name;
subsubFolder = subFolder(1:4);
subFolderPath = fullfile(folderPath, subFolder);
% 读取第一个tif影像获取基本信息
tifFile = dir(fullfile(subFolderPath, '*.tif'));
tifFilePath = fullfile(subFolderPath, tifFile(1).name);
[a, R] = geotiffread(tifFilePath);
info = geotiffinfo(tifFilePath);