TP-traitement-audio-visuel/TP4/attache_donnees_RVB.m
2023-06-22 20:47:16 +02:00

16 lines
483 B
Matlab

function AD = attache_donnees_RVB(I,moyennes,variances)
[nx,ny,nc] = size(I);
N = length(moyennes);
AD = zeros(nx,ny,N);
for i = 1:nx
for j = 1:ny
for k = 1:N
sigma(:,:) = variances(k,:,:);
x(:) = I(i,j,:);
mu(:) = moyennes(k,:);
AD(i,j,k) = 1/((2*pi)^(nc/2)*sqrt(det(sigma))) ...
* exp(-1/2*(x-mu)*(sigma\(x-mu)'));
end
end
end
end