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

17 lines
373 B
Matlab

function u_barre = calcul_structure_2(u, b, Dx, Dy, lambda, epsilon)
u_reshaped = reshape(u,[], 1);
N = length(b);
coeffs = 1 ./ sqrt( (Dx * u_reshaped).^2 + (Dy * u_reshaped).^2 + epsilon );
W = spdiags(coeffs, 0, N, N);
A = speye(N) + lambda * (Dx' * W * Dx + Dy' * W * Dy);
u_barre = A \ b;
u_barre = reshape(u_barre,size(u));
end