我正在实施自适应扩张和侵蚀。这是较早的问题的后续问题。我写了这段代码:
%% dilation and erosion
f = input('Enter the input image for dilation: ');
f_dil = zeros(size(f));
f_ero = zeros(size(f));
padf = padarray(f,[M M],'replicate','both');
padfrow = size(padf,1);
padfcol = size(padf,2);
for i = M+1:padfrow-M
for j = M+1:padfcol-M
W = SE{i-M,j-M}.*padf(i-M:i+M,i-M:i+M);
f_dil(i-M,j-M) = max(max(W));
f_ero(i-M,j-M) = min(min(W));
end
end
但我没有获得良好的侵蚀和扩张结果。我不知道用于计算 LST 和特征值的代码是否有问题!
这些是示例图像及其与我的代码的膨胀: