-
Notifications
You must be signed in to change notification settings - Fork 3
/
week1q13.txt
7 lines (7 loc) · 1.51 KB
/
week1q13.txt
1
2
3
4
5
6
7
Question 13
(Optional)
If planning on using Matlab (recommended), watch the tutorial videos provided in the corresponding section, and perform “help images” in the Matlab command line for examples of important image related commands.
Write a computer program capable of reducing the number of intensity levels in an image from 256 to 2, in integer powers of 2. The desired number of intensity levels needs to be a variable input to your program.
Using any programming language you feel comfortable with (it is though recommended to use the provided free Matlab), load an image and then perform a simple spatial 3x3 average of image pixels. In other words, replace the value of every pixel by the average of the values in its 3x3 neighborhood. If the pixel is located at (0,0), this means averaging the values of the pixels at the positions (-1,1), (0,1), (1,1), (-1,0), (0,0), (1,0), (-1,-1), (0,-1), and (1,-1). Be careful with pixels at the image boundaries. Repeat the process for a 10x10 neighborhood and again for a 20x20 neighborhood. Observe what happens to the image (we will discuss this in more details in the very near future, about week 3).
Rotate the image by 45 and 90 degrees (Matlab provides simple command lines for doing this).
For every 3×3 block of the image (without overlapping), replace all corresponding 9 pixels by their average. This operation simulates reducing the image spatial resolution. Repeat this for 5×5 blocks and 7×7 blocks. If you are using Matlab, investigate simple command lines to do this important operation.