function nablaI = Gradient(I); 

% function nablaI = Gradient(I);
%
% Calcule le gradient d'une image. 
 
[N1,N2] = size(I); 
S1 = [N1 1:N1-1]; 
S2 = [N2 1:N2-1]; 
nablaIx = cat(2,I-I(:,S2)); 
nablaIy = cat(2,I-I(S1,:));
nablaI = zeros(N1,N2,2); 
nablaI(:,:,1) = nablaIx; nablaI(:,:,2) = nablaIy; 
end


