2
PPM filtroDeGaus(PPM img){
int l,c,a,b,s=0;
int mask[5][5] = {{ 2, 4, 5, 4, 2 },
{ 4, 9, 12, 9, 4 },
{ 5, 12, 15, 12, 5 },
{ 4, 9, 12, 9, 4 },
{ 2, 4, 5, 4, 2 }};
for( l= 2; l < img.l-2; l++){
for(c = 2; c < img.c-2; c++){
for(a = -2; a < 2; a++){
for(b = -2; b < 2; b++){
s+=(img.pixel[l+a][c+b].r * mask[a+2][b+2]);
}
}
img.pixel[l][c].r = s/159;
img.pixel[l][c].g = s/159;
img.pixel[l][c].b = s/159;
s=0;
}
}
return img;
}
estruct
you receive as a parameter.
typedef struct {
int r, g, b;
}PIXELS;
typedef struct {
int c;
int l;
char tipo[2];
unsigned int corMax;
PIXELS **pixel;
}PPM;
This function is to apply Gaussian filter, only that the output is being this: