I'd really appreciate any help that can be offered here. My code seems to output a blurred image perfectly, but fails every check50 check and I can't work out why...
void blur(int height, int width, RGBTRIPLE image[height][width])
{
//Copy image over to new RGBTRIPLE
RGBTRIPLE image_copy[height][width];
for (int a = 0; a < height; a++)
{
for (int b = 0; b < width; b++)
{
image_copy[a][b] = image[a][b];
}
}
//Cycle through each pixel of image
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
//Define 3x3 pixel array
RGBTRIPLE arr[3][3];
int i_proxy = i - 1;
int j_proxy = j - 1;
int null_count = 0;
//Populate 3x3 array
for (int k = 0; k < 3; k++)
{
for (int l = 0; l < 3; l++)
{
if (i_proxy < 0 || i_proxy == height || j_proxy < 0 || j_proxy == width)
{
arr[k][l].rgbtBlue = 0;
arr[k][l].rgbtGreen = 0;
arr[k][l].rgbtRed = 0;
null_count++;
j_proxy++;
}
else
{
arr[k][l] = image_copy[i_proxy][j_proxy];
j_proxy++;
}
}
i_proxy++;
}
int sum_red = 0, sum_blue = 0, sum_green = 0;
for (int m = 0; m < 3; m++)
{
for (int n = 0; n < 3; n++)
{
sum_red += arr[m][n].rgbtRed;
sum_blue += arr[m][n].rgbtBlue;
sum_green += arr[m][n].rgbtGreen;
}
}
int pixel_type = 9 - null_count;
image[i][j].rgbtBlue = round((float) (sum_blue / pixel_type));
image[i][j].rgbtGreen = round((float) (sum_green / pixel_type));
image[i][j].rgbtRed = round((float) (sum_red / pixel_type));
}
}
return;
}