Question

Question: 1
We want to write a brightness filter that brightens a given pixel.



Which of the following instructions would brighten a pixel? Assume R is the red value of the pixel, G is the green value, and B is the blue value.



R = R + 50;
G = G + 50;
B = B + 50;

R = Math.min(R + 50, 255);
G = Math.min(G + 50, 255);
B = Math.min(B + 50, 255);

R = R - 50;
B = B - 50;
G = G - 50;

R = Math.max(R - 50, 0);
B = Math.max(B - 50, 0);
G = Math.max(G - 50, 0);

Answers

There are no human answers yet.
Answered by GPT 3.5
Option 2: R = Math.min(R + 50, 255); G = Math.min(G + 50, 255); B = Math.min(B + 50, 255);

This option ensures that the values of R, G, and B do not exceed 255, which is the maximum value for each color channel in a pixel.

Related Questions