Due: 4:00 p.m., Tuesday, 18 September 2007
This homework is also available in PDF.
Summary: In this assignment, you will build a number of simple filters.
Purposes: To reinforce the basic concepts of anonymous functions. (After all, practice makes perfect.) To bridge concepts from color theory into the course. To give you the opportunity to explore the algorithms for somewhat more complex transformations
Expected Time: 1-2 hours (for those who completed most of the lab on anonymous procedures); 2-3 hours (for those who did not)
You must work in a group of size two or three. You may discuss this
assignment and possible solutions with anyone you wish. If you discuss
this assignment with people other than group members, make sure to include
a citation (e.g.,
I consulted this person, who helped me
Submitting: Email me your answer. More details below.
Warning: So that this assignment is a learning experience for everyone, I may spend class time publicly critiquing your work.
Complete Exercise 6 from the lab on writing anonymous procedures.
Complete Exercise 3 from the lab on writing anonymous procedures.
Older photographs are not black and white, but rather closer to brown and white, due to some combination of the chemicals used to make images and the ravages of time. (Sorry, I don't know what old photographs looked like when they were new.) Some people like the aged look of sepia-toned images enough to desire them.
To produce a sepia-tone image, start with a grayscale image you created with the code from Part B. Then, write a new instruction to transform the grayscale image so that black becomes sepia (a very dark brown), while white remains white.
How can we accomplish this? We want to adjust the colors in the image so that every pixel has a red component that is at least as large as the red component of sepia. But, so that we don't lose distinctions between bright pixels in the image, the red component should not be 255 (the maximum) unless it was 255 in the original image. Numbers in between should be scaled appropriately. Similarly for the green and blue components.
There is not a color named "sepia" in the color name list, but
(define sepia (cname->rgb "bakers chocolate"))
gives a pretty good approximation.
If you write your instructions well, you should be able to replace
sepia with another dark color (and thus get a green-scale or blue-scale image, for example).
The last part specified that "white remains white." What if we used a light color instead of white, and a dark color instead of black? In effect, we transform white to that light color, black to a dark color, and shades of grey to intermediates between the light and dark colors..
dark to be a dark color of your choice and
light to be a light color of your choice. Write a Scheme instruction to transform the grayscale image such that black is transformed to
dark, white is transformed to
light, and the colors in between are scaled appropriately. Your instructions from Part C should be a helpful starting place.
Find a compelling pair of colors to use with your color-blend filter from Part D. Try to describe the color scheme using the color theory terminology we learned from Professor Kluber.
I will primarily look at whether your instructions are correct, automatic, and general. Since many of you have been negligent in writing general code, I will pay particular attention to the generality of your code: How easy will it be to change your program to do something similar?
I am also likely to consider at the formatting and readability of your code.
Please submit this work via email. The email should be titled CSC151.02 Assignment 06 and should contain your answers to all parts of this assignment. Make sure to include your answer to Part E. You need not attach any images, but I may ask you to demonstrate them in class.
Please send your work as the body of an email message. I don't like attachments, and prefer not to receive them when they can be avoided.
Thursday, 13 September 2007 [Janet Davis]
Friday, 14 September 2007 [Samuel A. Rebelsky]
I usually create these pages
on the fly, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Mon Dec 3 09:55:57 2007.
The source to the document was last modified on Fri Sep 14 09:23:18 2007.
This document may be found at
You may wish to validate this document's HTML ; ;Samuel A. Rebelsky, email@example.com
http://creativecommons.org/licenses/by-nc/2.5/or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.