Lab 12: Pixel Neighbor Edges
- Copy over the starter files at /users/smatzko/212/public/.
The provided C/C++ code handles reading the image into a buffer, creating a buffer for the output image, and
creating 2-dimensional variables (in2D, out2D) for referencing the image buffers.
- Modify the code for apply_filter to create and output a modified image similar to the Lena example below.
("Lena" is an image that is commonly used in graphics, purportedly because of the interesting
graphical qualities present (skin, hair, feathers, etc), and not because the picture originally can
from a Playboy magazine.)
- Create a bitset of size 9 to hold data about the 9 pixels in a 3x3 block,
- For each grayscale pixel in the image,
- for each of the surrounding pixels (3 about, 3 in the middle, and 3 below)
- If the absolute difference between the pixel values > t,
- Set the corresponding bit in the bitset to 1. Corresponding: upper left pixel is element 0, etc.
- If the bitset has is 8 or 0 bits set (to 1), set the pixel to black (0). Otherwise, white (255).
- To prevent falling off the edges, use mod:
e.g. row = (row+height)%height.
- You need to loop through each pixel (nested for loops), and then for each pixel, loop through the
3x3 block of pixels surrounding it (more nestsed for loops).
Turn in all of the code, and the Makefile.
sendlab.212.302 12 *.o *.cpp *.h Makefile