1
我有以下函数可以计算GLCM,然后计算给定的统计参数。我想将这个函数传递给NLFILTER来完成整个图像的计算(在小窗口中,例如卷积)。我已经那么NLFILTER设置使用并行计算工具箱来运行,所以我真的很想功能转换我有如下:用于NLFILTER的MATLAB匿名函数句柄
function [s]=glcm(img,meth)
%GLCM calculates a Gray Level Co-occurence matrix & stats for a given sub
% image.
% Input: Sub Image (subI) and a method (meth)...
% 'Contrast','Correlation','Energy','Homogeneity'
%
subI=uint8(img);
m=graycomatrix(img,'Offset',[0 1],'NumLevels',8,'Symmetric',true);
if meth(1:3)=='con'
s=graycoprops(m,'Contrast');
s=s.Contrast;
elseif meth(1:3)=='cor'
s=graycoprops(m,'Correlation');
s=s.Correlation;
elseif meth(1:3)=='ene'
s=graycoprops(m,'Energy');
s=s.Energy;
elseif meth(1:3)=='hom'
s=graycoprops(m,'Homogeneity');
s=s.Homogeneity;
else
error('No method selected.')
end
我真的停留在如何将其转换为适合于功能手柄与NLFILTER一起使用。有任何想法吗?谢谢。
正是我一直在寻找,谢谢! – MBL