This code is supposed to blur an image together with other supporting files as per CS50 Pset4. I am able to compile my code with no errors and run the program but it does not seem to blur my image correctly, i get a very very dark contrast image as output.

Does anyone see anything wrong with my code? New to coding so please help!! thank youu

    // Blur image
    void blur(int height, int width, RGBTRIPLE image[height][width])
    {
    RGBTRIPLE tmpimg[height][width];
    RGBTRIPLE sum;
    for(int i = 0; i < height; i++)
    {
        for(int j = 0; j < width; j++)
        {
            int counter = 0;
            sum.rgbtRed = 0;
            sum.rgbtGreen = 0;
            sum.rgbtBlue = 0;
            for(int a = -1; a < 2; a++)
            {
                for (int b = -1; b < 2; b++)
                {
                    if((i + a) >= 0 && (i + a) <= height - 1 && (j + b) >= 0 && (j + b) <= width - 1)
                    {
                        sum.rgbtRed += image[i + a][j + b].rgbtRed;
                        sum.rgbtGreen += image[i + a][j + b].rgbtGreen;
                        sum.rgbtBlue += image[i + a][j + b].rgbtBlue;
                        counter++;
                    }
                }
            }
            tmpimg[i][j].rgbtRed = round(sum.rgbtRed / counter);
            tmpimg[i][j].rgbtGreen = round(sum.rgbtGreen / counter);
            tmpimg[i][j].rgbtBlue = round(sum.rgbtBlue / counter);
        }
    }
    for(int i = 0; i < height; i++)
    {
        for(int j = 0; j < width; j++)
        {
            image[i][j] = tmpimg[i][j];
        }
    }
    return;
}