8Fermer10
onlymedLe 19/04/2008 à 18:01
Bonjour ,
merci de votre reponse mais la j'ai un autre soucis en effet j'ai jamais fait du traitement d'image ( c'est plutot de la programmation parallele ce que j'essaie de faire UPC )

la ma question est sur l'application du filtre sachant que j'ai entourer l'image pas un pixel 0

00000
0xxx0
0xxx0
00000

puis j'essaie d'appliquer le filtre

0-10
-15-1
0-10
alors je procede comme suite :
void appliquerFiltre(char* name)
{
MatriceImgROut=fmatrix_allocate_2d(length,width);
MatriceImgVOut=fmatrix_allocate_2d(length,width);
MatriceImgBOut=fmatrix_allocate_2d(length,width);
coefficients=fmatrix_allocate_2d(3,3);



int h , w , i , j ;


// matrice de trasformation
coefficients[0][0] = 0 ;
coefficients[0][1] = -1;
coefficients[0][2] = 0 ;
coefficients[1][0] = -1;
coefficients[1][1] = 5;
coefficients[1][2] = -1 ;
coefficients[2][0] = 0 ;
coefficients[2][1] = -1 ;
coefficients[2][2] = 0 ;

for (h = 0 ; h < length ; h++)
for (w = 0 ; w < width ; w++)
{

/*
MatriceImgROut[h][w] = 0 ;
MatriceImgVOut[h][w] = 0 ;
MatriceImgBOut[h][w] = 0 ;*/

for (i = 0 ; i < 3 ; i++)
for (j = 0 ; j < 3 ; j++)
{
MatriceImgROut[h][w] += coefficients[i][j] * MatriceImgR[h+i][w+j] ;
MatriceImgVOut[h][w] += coefficients[i][j] * MatriceImgV[h+i][w+j] ;
MatriceImgBOut[h][w] += coefficients[i][j] * MatriceImgB[h+i][w+j] ;
}

if(MatriceImgROut[h][w]<0)
MatriceImgROut[h][w]=0;
else
if(MatriceImgROut[h][w]>255)
MatriceImgROut[h][w]=255;

if(MatriceImgVOut[h][w]<0)
MatriceImgVOut[h][w]=0;
else
if(MatriceImgVOut[h][w]>255)
MatriceImgVOut[h][w]=255;

if(MatriceImgBOut[h][w]<0)
MatriceImgBOut[h][w]=0;
else
if(MatriceImgBOut[h][w]>255)
MatriceImgBOut[h][w]=255;

}


puis j'affiche la nouvelle image est la j'ai un resultat different de ce que j'attend
sachant que si j'ouvre et je sauvegarde sans modification l'image reste la méme donc c'est plutot au moment de l'application du filtre que j'ai un probleme

voici les deux image et les resultat :


HW4d
OP29


puis méme on dirai que l'image OUT est coupé en 4-5 parties .

merci si vous voyer un probleme quelque part.