function [image_piece, courbe] = m_and_s_artefact( l, c, N, h, k1) % On appelle les fonctions handles ed = @edginess; cons = @byaverage; n = @norme; moy = @moyenne; % Voila la premiere boucle pour trouver % les edges et la matrice qui va avec B = N; for k = 0:h for i = 1:2^(k+1):l-2^k for j = 1:2^(k+1):c-2^k e(i,j) = sqrt(((B(i,j)-B(i+2^k,j+2^k))^(2))*(B(i+2^k,j)-B(i,j+2^k))^(2)+(B(i,j)*B(i+2^k,j+2^k)-B(i+2^k,j)*B(i,j+2^k))^(2)); m = (B(i,j) + B(i+2^k,j) + B(i,j+2^k) + B(i+2^k,j+2^k))/4; d(i,j) = (B(i,j)-m)^(2)+(B(i+2^k,j)-m)^(2)+(B(i,j+2^k)-m)^(2)+(B(i+2^k,j+2^k)-m)^(2); R(i,j) = e(i,j)*d(i,j); if R(i,j) < k1 B(i:i+2^(k+1)-1,j:j+2^(k+1)-1) = (B(i,j) + B(i+2^k,j) + B(i,j+2^k) + B(i+2^k,j+2^k))/4; end end end % Et on affiche l'image comme d'HABITUUUUUUDE image_piece = mat2gray(B); imwrite(image_piece,'lenamas3.tif'); figure, image_piece = imshow(B); %,title(['matrix',num2str(k+1),'by',num2str(k+1)]); end