So, I currently have this solution for the sepia function of the filter problem.
void sepia(int height, int width, RGBTRIPLE image[height][width])
{
int b, g, r;
// Apply sepia algorithm to each pixel
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
b = round(0.272 * image[i][j].rgbtRed
+ 0.534 * image[i][j].rgbtGreen
+ 0.131 * image[i][j].rgbtBlue);
if (b > 255) image[i][j].rgbtBlue = 255;
else image[i][j].rgbtBlue = b;
g = round(0.349 * image[i][j].rgbtRed
+ 0.686 * image[i][j].rgbtGreen
+ 0.168 * image[i][j].rgbtBlue);
if (g > 255) image[i][j].rgbtGreen = 255;
else image[i][j].rgbtGreen = g;
r = round(0.393 * image[i][j].rgbtRed
+ 0.769 * image[i][j].rgbtGreen
+ 0.189 * image[i][j].rgbtBlue);
if (r > 255) image[i][j].rgbtRed = 255;
else image[i][j].rgbtRed = r;
}
}
}
As far as I can tell, this should work, but only the red (or blue, I don't know what order check50 prints the values in) is correct, while the others are consistently way off.
I've checked the values used in the algorithms and I don't see the issue? It's definitely not a rounding error either - the values are multiple integers off.