TP-traitement-audio-visuel/TP4/regularisation.m

12 lines
230 B
Mathematica
Raw Normal View History

2023-06-22 18:47:16 +00:00
function terme = regularisation(i, j, k, classe)
pad = padarray(k, [1, 1]);
voisins = pad(i:i+2, j:j+2);
kron = (voisins == classe);
kron(2,2) = 0; % on enlève le pixel (i,j)
terme = sum(1 - kron(:));
end