Image

c36-fig-5001.jpg

Collage Machine

Collect a directory of images. Write a program that uses these to generate collages of images. Include some unpredicability within it so that it generates a different collage each time it runs.

c36-fig-5002.jpg

Color of a Pixel

Display an image. Create an interactive system that continually fetches the color of the pixel under the mouse as it passes over this image. Use this color to fill a shape drawn to the screen as the mouse is moved around.

c36-fig-5003.jpg

Subsample and Downsample

Write a program that pixelates an image to produce a low-resolution version. Begin by subsampling the image (destination pixels are selected from the original). Then, downsample the image (destination pixels are local averages).

c36-fig-5004.jpg

Random Dot Dithering

Load an image into memory and fetch the brightness of a pixel in a random location. Generate a random number between 0 and 255; if it is greater than the brightness of the pixel, draw a black dot at a corresponding location on the canvas. Repeat as the picture emerges.

c36-fig-5005.jpg

Searching for the Brightest Point

Display the live video feed from your webcam to the screen and process the pixels to find the brightest point in the image. Place an indicator at the location of this pixel.

c36-fig-5006.jpg

Image Averaging

Collect ten or more images labeled with the same word or concept, such as “apple,” “sunset,” or “clock.” Ensure that all of the images have the same pixel dimensions. Compute a new image that is the pixelwise average of the collection, as a way to visualize regularities in the representation of that concept.

c36-fig-5007.jpg

Edge Detector (Sobel Filter)

Write a program that uses a Sobel filter to detect and display the edges in an image. If you can, compute the strength and orientation of these edges.

c36-fig-5008.jpg

Pixel Sort

Sort the pixels of an image by brightness. Then repeat the exercise, but sort by hue. For tips, see Dan Shiffman's “Coding Challenge #47: Pixel Sorting in Processing” in his Coding Train video of December 21, 2016.