I just ran my code through check50 and it's throwing the following errors:
:( sepia correctly filters more complex 3x3 image
:( sepia correctly filters 4x4 image
But I looked further into the issue and all the values my code produces are correct?
I looked into other people's questions for this, but I think I'm rounding correctly and checking for the upper limit, so why is it flagging incorrect?
void sepia(int height, int width, RGBTRIPLE image[height][width])
{
int sepiaRed = 0;
int sepiaGreen = 0;
int sepiaBlue = 0;
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
float originalRed = image[i][j].rgbtRed;
float originalGreen = image[i][j].rgbtGreen;
float originalBlue = image[i][j].rgbtBlue;
sepiaRed = round(0.393 * originalRed + 0.769 * originalGreen + 0.189 * originalBlue);
sepiaGreen = round(0.349 * originalRed + 0.686 * originalGreen + 0.1688 * originalBlue);
sepiaBlue = round(0.272 * originalRed + 0.534 * originalGreen + 0.131 * originalBlue);
if (sepiaRed > 255)
{
sepiaRed = 255;
}
if (sepiaGreen > 255)
{
sepiaGreen = 255;
}
if (sepiaBlue > 255)
{
sepiaBlue = 255;
}
image[i][j].rgbtRed = sepiaRed;
image[i][j].rgbtGreen = sepiaGreen;
image[i][j].rgbtBlue = sepiaBlue;
}
}
return;
}