I minimally expect you to be able to complete section 0,1 and 2 of this lab. If you complete through section 3 you will have no difficulty with the homework assignment. Section 4 provides an extra challenge.
0. Starting DrScheme
The following steps will prepare you to begin todays lab. This is part of the assignment, so take your time!!
- Start Dr. Scheme from the hard drive, and choose Beginning Student as the language. Make sure you have selected PLT Scheme v299.400.
- Choose the Teachpack image.ss in the directory htdp.
- Save the template file you will use for your work on the Desktop and open in DrScheme by choosing File -> Open....
- Add your names to the top of the template file!!
- Save your work!!.
- Open the DrScheme Help Desk and select Teachpacks, then Composing Images (image.ss). This is a description of the image library we will use in this tutorial.
- Here is a brief overview of DrScheme.
1. Colors
There are two ways to select a color in DrScheme. First, there
are a few colors that have symbolic names:
'red, 'green, 'blue,
'yellow, 'black, 'brown,
'violet
(There are other symbolic names, which you may discover by experimenting.) Second, all colors can be described by specifying the amount of the basic colors red, green, blue using a complex expression
(make-color r-val g-val b-val) where the three arguments take values 0-255. Here are some examples
-
(make-color 255 0 0)is red. -
(make-color 0 255 0)is green. -
(make-color 0 0 255)is blue.
There are four parts to this exercise. You will need the basic
shapes of the image library (circle, rectangle,
etc.) and the overlay operation for buiding complex
images from simple images. These are found in the Help Desk.
Here is an example of concentric
circles for part B:
2. Images, Part I
There are two parts to this exercise. You will need to use two additional
functions: image-height and image-width in
the image library.
For part A you will import an image into DrScheme. Here is an explanation, and the image to import (mystery meat.)
For part B you will anomalyze an image. Here is an example of a picture of
(former) President Randel before and anomylized
3. Images, Part II
There are three parts to this exercise. You will need the function
overlay/xy from the image library. The description of this
function is incorrect in the Help Desk. Here is the correct description
-
overlay/xy : image int int image -> image
to add pixels of the second image onto the first image. Instead of lining up on the pinhole, the second image's pinhole is offset from the first image's pinhole. The two coordinates specify how far to the right (or left if number is negative) and how far down (or up if number is negative) the offset should be. The pinhole of the resulting image is the same place as the pinhole in the first image.
The caption is below, but shifted a bit to the right. Why is this? If you attempt the Extra Credit, you will be able to ponder this further and even fix it.
4. Extra Credit
This is extra, and introduces a difficulty that you probably
encountered, as I did in my naive implementation of below
(above.) The problem
has to do with the location of the pinhole, and will arise if you try
to write a function like above, right or
left. For this section you will want to look at the
function put-pinhole in Help Desk.
Below, is a naive attempt to implement above, by putting
one image to the above another image, where the problem is more blatant:
In this case I tried to put the text to the right of the mystery meat, but it overlapped. Why?
5. Submitting Your Assignment
Submit Your Assignment via the Dropbox for this Class (CS151).
Kenneth Harris
kaharris@cs.uchicago.edu