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:
- Clicking on Start
- Then click on All Programs
- Then click on Class Applications
- Then click on Engineering
- 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:
- Contain a comment indicating
- your Name,
- Net-ID,
- Course Name,
- Assignment Name and
- a short description of
the assignment
- Contain a JES function that will
- allow the user to pick an image using pickAFile().
- change the selected image to an eight color posterized
image.
- display the posterized image.
- allow the user to save the image where the name of the
file is determined by using pickAFile().
This function may call other functions that are built-in to JES or
that you have written.
Submittal of the Lab Assignment
- You are submit your program electronically by placing it in the
digital drop box in blackboard.
- Programs that are correct and
submitted by noon on the Wednesday
the lab assignment is discussed will receive an extra 10% on the
score of the lab.
- When saving your program, use a meaningful name like lab5.py.
- When submitting your lab assignment, place all of the needed files it in a
zippped folder (even if you are only submitting one file) with the name
of yournetid_lab# and submit that zipped folder to the digital
drop box. For instance, if your net id is
abc32 then the folder name should be abc32_lab#5.
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.