12 lines
230 B
Matlab
12 lines
230 B
Matlab
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
|
|
|