CS 101 - Introduction to Computing, Spring 2007

Lab 5

This lab assignment will have you write a jython program that will posterize an image with 8 colors.

Reminder

The program Jython Environment for Students (or JES) is the development environment that we will use for this lab.

In the ACCC Labs that have JES, it can be found by:

  1. Clicking on Start
  2. Then click on All Programs
  3. Then click on Class Applications
  4. Then click on Engineering
  5. Finally click on Jython Environment for Students

Posterization

Posterization is a technique that reduces the amount of color used in an image. There is an example of posterization in the examples from lecture 2/13/2007. This example uses if statements for reduce an image to 64 colors. For this lab, we will want to reduce an image to the following 8 colors:


Black
r = 0
g = 0
b = 0

Red
r = 255
g = 0
b = 0

Green
r = 0
g = 255
b = 0

Blue
r = 0
g = 0
b = 255

Yellow
r = 255
g = 255
b = 0

Magenta
r = 255
g = 0
b = 255

Cyan
r = 0
g = 255
b = 255

White
r = 255
g = 255
b = 255

Note that the red, green and blue values for each image is either 0 or 255. So when doing this, you will need to check the intensity level for each of the three colors at every pixel. If the intensity level for a color is 127 or less, set the intensity of that color to 0. If the intensity level for a color is 128 or more, set the intensity of that color to 255. One proplem that you may find is that if an image or section of the images is fairly dark (no color value is above 128), this version of posterization will result in a pure black image or section of the image.

Here are some images to try this out with. There were selected because they may end up with bad posterized versions. Try to find an image that results in a good posterized version.

Lab Assignment 5

Due: Tuesday 2/20/2007 by 11:59 pm

Create a file using JES that will:

  1. Contain a comment indicating

  2. Contain a JES function that will This function may call other functions that are built-in to JES or that you have written.

Submittal of the Lab Assignment

Comments on the ACCC Labs

On the computers in the ACCC Labs there should an H: drive. This drive is actually a networked connection to your own file space maintained by the ACCC. No matter what machine you use or what lab you are in, the H: drive will access the same file space. This means that you can save a file on the H: drive on a computer in one lab and access that same file on a computer in another lab. This can be very helpful. It is suggested that you store your python program files on your H: drive.