function [R, l, c, N] = matrice_R_G2(J,a) close all; figure, imshow(J); ed = @edginess; cons = @byaverage; n = @norme; gradient = @grad; J = imread(J); R = []; % On decompose l'image en couleur dans les trois directions RGB1 = J(:,:,1); RGB2 = J(:,:,2); RGB3 = J(:,:,3); N(:,:,1) = im2double(RGB1); N(:,:,2) = im2double(RGB2); N(:,:,3) = im2double(RGB3); % Petites transformations pour affiner au besoin for e = 1:3 if a == 1 N(:,:,e) = wiener2(N(:,:,e),[3 3]); elseif a == 2 N(:,:,e) = histeq(N(:,:,e)); end end [l,c] = size(N(:,:,1)); R = zeros(l-1,c-1,3); % Et on calcule les valeurs importantes for r = 1:3 N_inter = N(:,:,r); for i = 1:l-1 for j = 1:c-1 e(i,j) = feval( ed, N_inter, i, j); d(i,j) = feval( cons, N_inter, i, j); %g(i,j) = feval( gradient, N_inter, i, j, 1); %D(i,j,1,e) = d(i,j); R_inter(i,j)= e(i,j)*d(i,j); %G(i,j,1,e) = e(i,j)*d(i,j)*g(i,j); end end R(:,:,r) = R_inter; end