OER.ai

← Image Representation (Colour by Numbers)

Sub plan

Image Representation (Colour by Numbers)

Generated from the original open resource by CS Unplugged. Built only from the resource — nothing invented. Free, no login.

Objective

Students will learn how computers can store and represent pictures using only numbers, by decoding and creating "run-length coded" grid pictures (a simple form of image compression).

Materials

  • OHP transparency: Colour by Numbers (page 16), or simply draw the magnified letter "a" grid and its number code on the board
  • Copies of Worksheet Activity: Kid Fax (page 17) — one per student
  • Copies of Worksheet Activity: Make Your Own Picture (page 18) — one per student
  • Pencils (not pens, so mistakes can be erased) and erasers

Warm-up (~5 min)

  1. Ask students the following discussion questions and take a few answers for each:
  2. What do fax machines do?
  3. In what situations might a computer need to store a picture? (e.g., a drawing program, a video game, a multi-media system)
  4. How can a computer store a picture if it can only use numbers?
  5. Tell students that today they'll discover exactly how a computer can turn a picture into numbers.

Main Activity (~25 min)

  1. Demonstrate the code (5 min): Show the OHP transparency (or draw on the board) the magnified letter "a" made of pixels — each pixel is black or white. Explain:
  2. The picture is read line by line.
  3. The first number in each line always tells how many white pixels come first.
  4. Then numbers alternate: black run, white run, black run, etc.
  5. If a line begins with a black pixel, the line's code starts with a 0 (meaning "zero white pixels first").
  6. Walk through the example together: 1, 3, 1 means 1 white pixel, then 3 black pixels, then 1 white pixel. Confirm this matches the row shown in the magnified "a".
  7. Hand out Worksheet: Kid Fax (page 17) to each student. Explain that this worksheet has three pictures to decode using pencil, from easiest to hardest, and that mistakes are normal — that's why they should use pencil and keep an eraser handy.
  8. Students work individually (or in pairs) coloring in the grids according to the number codes, row by row, following the pattern demonstrated.
  9. Circulate and help students who get confused about whether to start counting white or black pixels, and remind them each number in a line represents a "run" of same-colored pixels.

Wrap-up / Exit Ticket (~10 min)

  1. Ask a few students to hold up their completed Kid Fax pictures and confirm as a class what image emerged in each grid.
  2. Hand out Worksheet: Make Your Own Picture (page 18). As an exit ticket, have each student:
  3. Draw a small, simple picture on the top grid.
  4. Write the run-length number code for at least the first two or three rows of their picture on the lines beside the bottom grid.
  5. Collect these partially completed worksheets as the exit ticket, showing whether students can translate a picture into the number code (not just decode numbers into a picture).

If Time Remains

Have students who finish early swap their Make Your Own Picture bottom grid (with just the numbers, cut along the dotted line) with a partner, and let the partner try to color in the grid using only the number code — checking whether the picture matches what was originally drawn.

Original licensed under CC BY-NC-SA 4.0. This teaching material is provided free by OER.ai.