Say we're doing fractal image compression/decompression using the method
discussed in class. Say that the variables
double s, o;
are set to the appropriate values to represent contrast and brightness
constants. Say that the variable
unsigned char domainimage[8][8];
contains the appropriate scaled-down portion of the original image. Write
the 3-5 lines of code that use s and o to adjust the contrast and brightness of
domainimage.
int scaled_value, i, j;
for (i=0; i < 8; i++) {
for (j=0; j < 8; j++) {
scaled_value = domainimage[i][j]*s + o;
if (scaled_value < 0) scaled_value = 0;
if (scaled_value > 255) scaled_value = 255;
domainimage[i][j] = scaled_value;
}
}