TP-traitement-audio-visuel/TP6/debruitage.m
2023-06-22 20:47:16 +02:00

16 lines
326 B
Matlab

function u_kp1 = debruitage(b, u_k, lambda, Dx, Dy, epsilon)
N = length(b);
% coeffs = 1 ./ sqrt( gradient(u_k).^2 + epsilon );
coeffs = 1 ./ sqrt( (Dx * u_k).^2 + (Dy * u_k).^2 + epsilon );
W = spdiags(coeffs, 0, N, N);
A = speye(N) + lambda * (Dx' * W * Dx + Dy' * W * Dy);
u_kp1 = A \ b;
end