Image ExercisesSetupThe teachpack and .plt files have changed for assignment 3. Re-download and re-install them.You must install utils-151.plt in your DrScheme v205. After downloading the file, choose File|Install .plt file to install it. Also, download this teachpack: image-teachpack.ss for use with these assignments. Use Language|Add Teachpack... once you've downloaded the teachpack. Teachpack DocumentationNote: you do not need all of these operations for each assignment.
Exercise 1.1, YouDefine the constant me to be a 128x128-pixel image of yourself. If you cannot obtain a picture of yourself in electronic form, find or create any 128x128-pixel image. We ask for a picture of you to help us learn your name and match it with a face. For best results with the following exercises, choose your image so that your eyes are centered in the image, and with the distance from the centers of your eyes at about 64 pixels. Exercise 1.2, DisguisesDefine the function add-glasses that takes two images: a person image, and an image (of any size) reprsenting glasses. The result should be an image with the given person wearing the glasses, which is constructed by centering the glasses image on top of the person image, and using the glasses image as its own mask. The function should not assume anything about the size of the images. Here are some glasses images that you can use for testing: Here is an example: Exercise 1.3, More DisguisesDefine the function add-beard that is like add-glasses, but the second image is a beard image. The beard should be centered horizontally, but bottom-aligned with the person image. The function should not assume anything about the size of the images. Here is a beard image that you can use for testing: Exercise 1.4, RecognitionDefine the function wearing-glasses? that takes two person images and a glasses image. It returns true or false . The result is true if the second image matches the first image plus glasses (so the result is true only when the second image already includes glasses). Exercise 1.5, DisguisesDefine the function same-person-maybe-disguised? that takes four images: a source person image, a target person image, a glasses image, and a beard image. It returns true or false. The result is true if the second image is that same as the first, possibily with glasses and/or beard added. Exercise 2.1, FramingFinish the program frame-person we discussed in lecture. It takes two images as arguments and returns an image. The first input is some picture and the second input is an image inside the first. It returns a new image with the second persons image framed inside.Making test examples can be a bit tricky, so here is an example for you: (frame-person Exercise 2.2, Potential FramingDevelop the program maybe-frame-person. It accepts two pictures as in 2.1 and if the second image is inside the first image, it frames the person as before. If the second image is not inside, it returns the original image, unmodified. In addition to the test case above, use this one: (frame-person Exercise 3.1, list-of-colorWrite a data definition for list of color (using the define-struct for color given above). Exercise 3.2, Black & WhiteDevelop the program black-and-white. It accepts an image and determines if it is a black and white image, that is, the function only has black, white, and grey pixels. Exercise 3.3, Kind of BlueDevelop the program kind-of-blue?, which takes an image and returns true if the total blue intensity of pixels in the image is greater than the total red intensity, and also greater than the total green intensity. Exercise 3.4, InversionDevelop the program invert, which takes and produces an image. The resulting image should be just like the input, except each pixel's color should be inverted. To invert a pixel, subtract each of its red, green, and blue coordinates from 255. For example, the pixel (make-color 55 100 155) would become (make-color 200 155 100). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Robby Findler |