Bonjour @ tous !

J'aimerais appliquer un filtre gaussien à mon image, mais je m'y prend mal et cela ne marche pas...


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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
// masque 3x3
 
	nLignes=3;
	nColonnes=3;
 
	masque = new int* [ nLignes ]; 
		 for( int i=0 ; i < nLignes ; i++ )
			 masque[i] = new int[ nColonnes ];
 
	for( int i=0 ; i < nLignes ; i++ ) 
		for( int j=0 ; j < nColonnes ; j++)
			masque[i][j]=i*j;
 
	masque[0][0] = 1;
    masque[0][1] = 2;
    masque[0][2] = 1;
    masque[1][0] = 2;
    masque[1][1] = 4;
    masque[1][2] = 2;
    masque[2][0] = 1;
    masque[2][1] = 2;
    masque[2][2] = 1;
	int coeffMasque=16;
 
	 for(int i = 0+1; i<larg_reelle; i++) // exclus 1ère et dernière ligne
	 {	
		 for(int j= 0+1; j<haut; j++) // exclus 1ère et dernière colonne 
		 {
			 for(int k=0 ;k<3;k++)
			{
				for(int l=0; l<3; l++)
				{
					image_filtree[k+l*3]+= image_bruitee[i+j*larg_reelle]*(masque[k+1][l+1]/coeffMasque);
				}
			 }
		 }
	 }
Pourriez vous m'expliquer les raisons qui font que cela ne marche pas ?
Merci d'avance,