gpt4 book ai didi

opencv - Emgu CV-各向异性扩散

转载 作者:行者123 更新时间:2023-12-02 17:53:08 28 4
gpt4 key购买 nike

有人可以指导我介绍各向异性扩散的一些现有实现方式,最好是 perona-malik扩散吗?

最佳答案

翻译以下MATLAB代码:

% pm2.m - Anisotropic Diffusion routines



function ZN = pm2(ZN,K,iterate);

[m,n] = size(ZN);

% lambda = 0.250;
lambda = .025;
%K=16;

rowC = [1:m]; rowN = [1 1:m-1]; rowS = [2:m m];
colC = [1:n]; colE = [2:n n]; colW = [1 1:n-1];
result_save=0;
for i = 1:iterate,
%i;
% result=PSNR(Z,ZN);
% if result>result_save
% result_save=result;
% else
% break;
% end
deltaN = ZN(rowN,colC) - ZN(rowC,colC);
deltaS = ZN(rowS,colC) - ZN(rowC,colC);
deltaE = ZN(rowC,colE) - ZN(rowC,colC);
deltaW = ZN(rowC,colW) - ZN(rowC,colC);
% deltaN = deltaN .*abs(deltaN<K);
% deltaS = deltaS .*abs(deltaS<K);
% deltaE = deltaE .*abs(deltaE<K);
% deltaW = deltaW .*abs(deltaW<K);

fluxN = deltaN .* exp(-((abs(deltaN) ./ K).^2) );
fluxS = deltaS .* exp(-((abs(deltaS) ./ K).^2) );
fluxE = deltaE .* exp(-((abs(deltaE) ./ K).^2) );
fluxW = deltaW .* exp(-((abs(deltaW) ./ K).^2) );


ZN = ZN + lambda*(fluxN +fluxS + fluxE + fluxW);
%ZN=max(0,ZN);ZN=min(255,ZN);
end

该代码不是我的,并且取自: http://www.csee.wvu.edu/~xinl/code/pm2.m

关于opencv - Emgu CV-各向异性扩散,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14715817/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com