Question: JAVA CODE Use a one-dimensional array to solve the following problem: You want to eventually perform some basic compression on an image. Assume that you
JAVA CODE
Use a one-dimensional array to solve the following problem: You want to eventually perform some basic compression on an image. Assume that you will only be operating on a single row of the image, and that pixel colors are represented as simple numbers in the array. You are required to quantize the values of the pixels in the row. In other words, any pixel values appearing in a range will assume a value in that range as indicated below. This creates redundancy that can lead to better compression.
Overwrite the original values in the array as follows:
| Pixel Value | Quantized Value |
| 0 to 20 | 10 |
| 21 to 40 | 30 |
| 41 to 60 | 50 |
| 61 to 80 | 70 |
| 81 to 100 | 90 |
| 101 to 120 | 110 |
| 121 to 140 | 130 |
| 141 to 160 | 150 |
| 161 to 180 | 170 |
| More than 180 | 190 |
In your output you must print the array with the new, quantized values.
Output should look like this:
Please input pixel values : pixel 1 : 17 pixel 2 : 32 pixel 3 : 47
pixel 4 : 78 pixel 5 : 93 pixel 6 : 112 pixel 7 : 134 pixel 8 : 154
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
