Vision Worksheet 1
Image Processing 1: Binary Images and Detecting Connected Components
Name ______________
Preliminary work:
Read about image file formats PGM and PPM
Read about 4 and 8 connectivity of
components in images.
1. A. Copy the image file: /home/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)
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". Should look like this.
This file should have the following header lines:
P2
# Comment line identifying this as a PGM binary imag, 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. Write a 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.