I'm not sure exactly what is wrong with my code. I don't get any runtime errors and my code compiles, but the image doesn't change at all compared with the original, and check 50 tells me I am out - putting incorrect values.
void blur(int height, int width, RGBTRIPLE image[height][width])
{
RGBTRIPLE blur[height][width];
for (int i = 0; i < height; i++)
{
int a;
int b;
if (i == 0)
{
a = 0;
b = 1;
}
else if (i == (height - 1))
{
a = 1;
b = 0;
}
else
{
a = 1;
b = 1;
}
for (int j = 0; j < width; j++)
{
int c;
int d;
if (j == 0)
{
c = 0;
d = 1;
}
else if (j == (width - 1))
{
c = 1;
d = 0;
}
else
{
c = 1;
d = 1;
}
float blue = 0;
float green = 0;
float red = 0;
float counter = 0;
for(int x = i - a; x < i + b; x++)
{
for (int y = j - c; y < j + d; y++)
{
blue += image[x][y].rgbtBlue;
green += image[x][y].rgbtGreen;
red += image[x][y].rgbtRed;
counter ++;
}
}
int blurblue = round(blue / counter);
int blurgreen = round(green / counter);
int blurred = round(red / counter);
blur[i][j].rgbtBlue = blurblue;
blur[i][j].rgbtGreen = blurgreen;
blur[i][j].rgbtRed = blurred;
}
}
for (int i = 0; i < height; i++)
{
for (int j = 0; j < height; j++)
{
image[i][j] = blur[i][j];
}
}
return;
}