Worksheet #8
Image Processing 1: Binary Images and Detecting Connected Components
Name ______________
Help for starting Image Processing with Lisp.
Preliminary work: Run the two programs from "Starting Image Processing
with Lisp" (see the link above) - arrayStarter.lsp and readFile.lsp.
Understand how each works before moving on. Also read about image file
formats PGM and PPM and the introduction to the concept of 4 and 8
connectivity of components in images.
1. A. Copy the image file: /home/atlas1/ai/image1.pgm.
B. Load the image using xv and magnify sufficiently so you can
see the 8 by 8 image.
(xv & then right click for the menu)
C. Copy the starter Lisp file: /home/atlas1/ai/connect4Starter.lsp.
2. A. Threshold the image so that all values below 100 are set to 0 and
all values equal to or above 100 are set to 255. Write the image
to a file named "binary1.pgm". The file should look like this.
This file should have the following header lines:
P2
# Comment line identifying this as a PGM binary image, binary.pgm
8 8
255
- the image pixel values should be here, 8 rows and 8 cols.
B. View binary1.pgm with xv to check if the objects are
in black against a white background.
3. A. Complete the program connect4.lsp that labels and counts all
"4-connected objects" in the picture. Print both the binary
image and the labeled component image on the screen.
View a sample output.
B. Write connect8.lsp to label and count the "8-connected" objects
in the image. View sample 8-connected labeled image.