Question: For this problem, you will manipulate a color image. The input to your function will be a two-dimensional array of ints. Each int represents one
For this problem, you will manipulate a color image. The input to your function will be a two-dimensional array of ints. Each int represents one pixel of the image. Each int contains 32 bits.
The colors in the image are represented using RGB (red-green-blue). The leftmost 8-bits of the int are unused. The next 8 bits represented how much red is in the image. This value can be anywhere from 0 (no red at all) to 255 (deepest possible red). The next 8 bits represent how much green is in the image. Finally, the rightmost 8 bits represented how much blue is in the image.
Your function should manipulate an image by increasing the contrast of the red hues.
For each pixel in the image, if the amount of red is at least 0x80 (ie 1000 0000), then the value of red at that pixel should be changed to be full red (ie 0xFF).
For each pixel in the image, if the amount of red is less than 0x80, then the value of red at that pixel should be changed to be half as strong a shade of red as the original value.
Complete the body of the following function so that it computes this transformation.
void increaseRedContrast ( int numRows, int numCols, int image[][numCols] )
{
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
