
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Spring 2008
Yes, the “for submission” part of this assignment is due on the same day as the midterm — sorry. How- ever, it does reinforce some concepts that will be part of the midterm, so rather than thinking of it as homework, think of it as additional preparation for the midterm.
Color and how pixels are represented in memory are covered in Section 2.5 in Angel.
Extend the Nanoshop sample program by imple- menting two (2) new color changers for it. Ideas include, but are not restricted to: brightness changer, contrast changer, inverter (i.e., creating a photo negative), and a tinter/blender.
Type up the distributed Nanoshop code — if you think about it, you really only need the Nanoshop class and the ColorChanger interface; no need to type up the sample ColorChanger implementations — then add your own color changers. For those of you who have taken CMSI 370, feel free to im- prove upon the user interface of the core Nanoshop application.
Commit your code to /homework/cmsi371/nanoshop.
You will receive extra credit if you expand the range of image processing operations that Nanoshop can perform as specified below.
Modify the ColorChanger interface’s changeColor() method so that it accepts an n × n “square” of col- ors, where n is an odd number, while still returning a single RGB tuple as a result. This “square” rep- resents the pixels surrounding the “current” pixel in the Nanoshop processImage() method, thus pro- viding additional information that can be used when “filtering” the original image. Implement two (2) color changers that take advan- tage of this “neighboring pixel” information. For example, you can return the mean of all colors as the result, or perhaps the median (the interpreta- tion of how the mean or median of a set of colors should be computed is left to you). Try to come up with something that you think will produce some kind of recognizable visual effect. Of course, the Nanoshop processImage() will also have to change slightly, so that it builds the square of colors that is sent to the new changeColor() method, with the current pixel at the square’s cen- ter. Make sure to handle the (literal) edge cases — for pixels at the corners or borders of the image, what colors should be placed in their non-existent “neighboring” areas?
If you complete this extra credit work, simply commit it as your version of Nanoshop, under the /homework/cmsi371/nanoshop directory.