谁有spfilt和intrans函数的M文件

谁有spfilt和intrans函数的M文件,第1张

function f = spfilt(g, type, m, n, parameter)

%

% f = spfilt(g, 'amean', m, n) 算术平均

% f = spfilt(g, 'gmean', m, n) 几何平均

% f = spfilt(g, 'hmean', m, n) 谐函数绝凳平均

% f = spfilt(g, 'chmean', m, n,Q) contraharmonic 平均

% f = spfilt(g, 'median', m, n) 中值

% f = spfilt(g, 'max', m, n) 最大值

% f = spfilt(g, 'min', m, n) 最小值

% f = spfilt(g, 'midpoint', m, n) 中点

% f = spfilt(g, 'atrimmed', m, n,D) alpha-trimmed 平均

%

if nargin == 2

m = 3n = 3Q = 1.5d = 2

elseif nargin == 5

Q = parameterd = parameter

elseif nargin == 4

Q = 1.5d = 2

else

error('Wrong number of inputs.')

end

switch type

case 'amean'

w = fspecial('average',[m,n])

f = imfilter(g,w,'replicate')

case 'gmean'

f = gmean(g,m,n)

case 'hmean'

f = harmean(g,m,n)

case 'chmean'

f = charmean(g,m,n,Q)

case 'median'

f = medfilt2(g, [m,n], 'symmetric')

case '仔宏答max'

f = ordfilt2(g,m*n,ones(m,n),'念慧symmetric')

case 'min'

f = ordfilt2(g,1,ones(m,n),'symmetric')

case 'midpoint'

f1 = ordfilt2(g,1,ones(m,n),'symmetric')

f2 = ordfilt2(g,m*n,ones(m,n),'symmetric')

f = imlincomb(0.5,f1,0.5,f2)

case 'atrimmed'

if (d<0) | (d/2~=round(d/2))

error('d must be a nonnegative, even integer.')

end

f = alphatrim(g,m,n,d)

otherwise

error('Unknown filter type.')

end

function f = spfilt(g, type, m, n, parameter)

%

% f = spfilt(g, 'amean', m, n) 算术平均

% f = spfilt(g, 'gmean', m, n) 几何平均

% f = spfilt(g, 'hmean', m, n) 谐函数绝凳平均

% f = spfilt(g, 'chmean', m, n,Q) contraharmonic 平均

% f = spfilt(g, 'median', m, n) 中值

% f = spfilt(g, 'max', m, n) 最大值

% f = spfilt(g, 'min', m, n) 最小值

% f = spfilt(g, 'midpoint', m, n) 中点

% f = spfilt(g, 'atrimmed', m, n,D) alpha-trimmed 平均

%

if nargin == 2

m = 3n = 3Q = 1.5d = 2

elseif nargin == 5

Q = parameterd = parameter

elseif nargin == 4

Q = 1.5d = 2

else

error('Wrong number of inputs.')

end

switch type

case 'amean'

w = fspecial('average',[m,n])

f = imfilter(g,w,'replicate')

case 'gmean'

f = gmean(g,m,n)

case 'hmean'

f = harmean(g,m,n)

case 'chmean'

f = charmean(g,m,n,Q)

case 'median'

f = medfilt2(g, [m,n], 'symmetric')

case '仔宏答max'

f = ordfilt2(g,m*n,ones(m,n),'念慧symmetric')

case 'min'

f = ordfilt2(g,1,ones(m,n),'symmetric')

case 'midpoint'

f1 = ordfilt2(g,1,ones(m,n),'symmetric')

f2 = ordfilt2(g,m*n,ones(m,n),'symmetric')

f = imlincomb(0.5,f1,0.5,f2)

case 'atrimmed'

if (d<0) | (d/2~=round(d/2))

error('d must be a nonnegative, even integer.')

end

f = alphatrim(g,m,n,d)

otherwise

error('Unknown filter type.')

end


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12259460.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存