Bonjour,
tout d'abords un GRAND MERCI a tous ceux ki ont participé ds la conception de ce site.
En fait j'ai un proble avec un filtre image avec matrice 5*5, ca compile mais quand je le lance il bloque et note:
SEGUEMENTATION FAULT? voici une partie du code:
dans image.c///////////////
ImagePtr Filtre5(ImagePtr I1 , double ** M)
{
int i,j;
double k;
ImagePtr I3=ImageConstructeur(I1->Largeur,I1->Hauteur);
for(i=2;i<(I1->Hauteur)-1;i++)
{
for(j=2;j<(I1->Largeur)-1;j++)
{
k=(double)I1->Pixels[i-2][j-2]*M[4][0]+(double)I1->Pixels[i-2][j-1]*M[4][1]+(double)I1->Pixels[i-2][j]*M[4][2]+(double)I1->Pixels[i-2][j+1]*M[4][3]+(double)I1->Pixels[i-2][j+2]*M[4][4]+(double)I1->Pixels[i-1][j-2]*M[3][0]+(double)I1->Pixels[i-1][j-1]*M[3][1]+(double)I1->Pixels[i-1][j]*M[3][2]+(double)I1->Pixels[i-1][j+1]*M[3][3]+(double)I1->Pixels[i-1][j+2]*M[3][4]+(double)I1->Pixels[i][j-2]*M[2][0]+(double)I1->Pixels[i][j-1]*M[2][1]+(double)I1->Pixels[i][j]*M[2][2]+(double)I1->Pixels[i][j+1]*M[2][3]+(double)I1->Pixels[i][j+2]*M[2][4]+(double)I1->Pixels[i+1][j-2]*M[1][0]+(double)I1->Pixels[i+1][j-1]*M[1][1]+(double)I1->Pixels[i+1][j]*M[1][2]+(double)I1->Pixels[i+1][j+1]*M[1][3]+(double)I1->Pixels[i+1][j+2]*M[1][4]+(double)I1->Pixels[i+2][j-2]*M[0][0]+(double)I1->Pixels[i+2][j-1]*M[0][1]+(double)I1->Pixels[i+2][j]*M[0][2]+(double)I1->Pixels[i+2][j+1]*M[0][3]+(double)I1->Pixels[i+2][j+2]*M[0][4];
if( k>255)
k=255;
if( k<0)
k=0;
I3->Pixels[i][j]=k;
}
}
return I3;
}
////////////////////////////////////////////////////////////////
dans projetimage.c////////////////////////////////////
case 18:
{
double **M;
M=(double**)malloc(sizeof(double*));
M[0][0]=1/25; M[3][0]=1/25;
M[0][1]=1/25; M[3][1]=1/25;
M[0][2]=1/25; M[3][2]=1/25;
M[0][3]=1/25; M[3][3]=1/25;
M[0][4]=1/25; M[3][4]=1/25;
M[1][0]=1/25; M[4][0]=1/25;
M[1][1]=1/25; M[4][1]=1/25;
M[1][2]=1/25; M[4][2]=1/25;
M[1][3]=1/25; M[4][3]=1/25;
M[1][4]=1/25; M[4][4]=1/25;
M[2][0]=1/25;
M[2][1]=1/25;
M[2][2]=1/25;
M[2][3]=1/25;
M[2][4]=1/25;
anImagePtr=Filtre5(Image1Ptr,M);
break;
}
case 19:
{
double **M;
M=(double**)malloc(sizeof(double*));
M[0][0]=11/864; M[3][0]=23/864;
M[0][1]=23/864; M[3][1]=48/864;
M[0][2]=29/864; M[3][2]=62/864;
M[0][3]=23/864; M[3][3]=48/864;
M[0][4]=11/864; M[3][4]=23/864;
M[1][0]=23/864; M[4][0]=11/864;
M[1][1]=48/864; M[4][1]=23/864;
M[1][2]=62/864; M[4][2]=29/864;
M[1][3]=48/864; M[4][3]=23/864;
M[1][4]=23/864; M[4][4]=11/864;
M[2][0]=29/864;
M[2][1]=62/864;
M[2][2]=80/864;
M[2][3]=62/864;
M[2][4]=29/864;
anImagePtr=Filtre5(Image1Ptr,M);
break;
}
case 20:
{
double **M;
M=(double**)malloc(sizeof(double*));
M[0][0]=1/80; M[3][0]=1/80;
M[0][1]=1/80; M[3][1]=3/80;
M[0][2]=3/80; M[3][2]=7/80;
M[0][3]=1/80; M[3][3]=3/80;
M[0][4]=1/80; M[3][4]=1/80;
M[1][0]=1/80; M[4][0]=1/80;
M[1][1]=3/80; M[4][1]=1/80;
M[1][2]=7/80; M[4][2]=3/80;
M[1][3]=3/80; M[4][3]=1/80;
M[1][4]=1/80; M[4][4]=1/80;
M[2][0]=3/80;
M[2][1]=7/80;
M[2][2]=16/80;
M[2][3]=7/80;
M[2][4]=3/80;
anImagePtr=Filtre5(Image1Ptr,M);
break;
}
///////////////////////////////////////////////////////
est ce que klk1 peut m'aidez svp..