voila j'essaie de faire un filtre gaussien d'une image couleur
voici ma fonction
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function GA=filtre_gausse(M)
I=imread(M);
R=I(:,:,1);
G=I(:,:,2);
B=I(:,:,3);
IN=rgb2gray(I);
[a,b]=size(IN);
R=floor(double(R));
G=floor(double(G));
B=floor(double(B));
GA=[zeros(a-2,b-2),zeros(a-2,b-2),zeros(a-2,b-2)];
for x=2:a-1;
    for y=2:b-1;
       GA(x-1,y-1,1)=uint8(double((R(x-1,y-1)+R(x,y-1)+R(x+1,y-1)+R(x-1,y)+R(x,y)+R(x+1,y)+R(x-1,y+1)+R(x,y+1)+R(x+1,y+1))/9));
       GA(x-1,y-1,2)=uint8(double((G(x-1,y-1)+G(x,y-1)+G(x+1,y-1)+G(x-1,y)+G(x,y)+G(x+1,y)+G(x-1,y+1)+G(x,y+1)+G(x+1,y+1))/9));
       GA(x-1,y-1,3)=uint8(double((B(x-1,y-1)+B(x,y-1)+B(x+1,y-1)+B(x-1,y)+B(x,y)+B(x+1,y)+B(x-1,y+1)+B(x,y+1)+B(x+1,y+1))/9));
    end
end
subplot(121);imshow(I);title('image _ M');
subplot(122);imshow(GA);title('image _ GR');
mais ça ne marche m'affiche une image blanche et me donne l'erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
??? Error using ==> image
TrueColor CData contains element out of range 0.0 <= value <= 1.0.

Error in ==> C:\MATLAB6p5\toolbox\images\images\imshow.m
On line 104  ==> hh = image(xdata, ydata, cdata, 'BusyAction', 'cancel', ...

Error in ==> C:\MATLAB6p5\work\filtre_gausse.m
On line 20  ==> subplot(122);imshow(GA);title('image _ GR');