C++ Filtre gaussien appliqué à une image

Fermé
JulieUSfan - 17 mai 2012 à 16:10
Bonjour,

J'aimerais créer un filtre gaussien à une image, mais mon code ne marche pas:
Pourriez vous m'aider svp ;)

double sigma=0.8;
int N=3, xi, yj;
int larg_reelle = abs(pitch);

for (int i=0; i<N; i++) // création des coef du masque 3x3
{
for (int j=0; j<N; j++)
{
xi = i - floor((double)N/2);
yj = j - floor((double)N/2);
masque[i+j*larg_reelle]= exp(-(xi*xi + yj*yj)/(2*sigma*sigma));
}
}




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)*larg_reelle]/coeffMasque);
}
}
}
}