function Image_par_parties = piececonstant(k3, l, c, N, t, T)

ed = @edginess;
cons = @byaverage;
n = @norme;
moy = @moyenne;
B = [];
B(l,:) = N(l,:);
B(:,c) = N(:,c);
for i = 1:l-1
    for j = 1:c-1
        e(i,j) = feval( ed, N, i, j);
        d(i,j) = feval( cons, N ,i, j);
        R(i,j) = e(i,j)*d(i,j);
        if R(i,j) > 0.00025*k3
            B(i,j) = 1;
        else B(i,j) = feval(moy, N, i,j);
        end
    end     
end
I_matrice = B;
%figure, Image_par_parties = imshow(I_matrice);
% On initialise
D = B;
% On lance l'iteration
for t = 1:T
    H(l,:) = D(l,:);
    H(:,c) = D(:,c);    
    for i = 1:l-1
        for j = 1:c-1
            C = D(i:i+1,j:j+1);
            if any(C) == 1
                H(i,j) = D(i,j);
            else H(i,j) = min(min(C));
            end
        end     
    end
    D = H;
end

I_matrice2 = D;
figure, Image_par_parties = imshow(I_matrice2);


%I_piece = im2bw(A);

