CS-171

Program Assignment 3

 

Objective

The objectives of this assignment include the following:

 

Assignment

For this assignment you will be creating a collage of images. You should choose your images and composition to reflect the interest that you have so that your collage tells us something about who you are. You will be creating a variety of image manipulation routines that will be needed to create your collage. Below is an example collage that was created by Dr. Kretchmar from the CS department.  His particular interests include running marathons and cycling.

 

 

Requirements

The requirements for this assignment can be partitioned broadly into (i) the base requirements (including following the instructions faithfully), (ii) a few required transformations, and (iii) a set of optional transformations.  Points are awarded in each category.

Base Requirements

Core Transformations

Elective Transformations

Details:

Crop: Cropping is the act of removing a portion of an image. You need to specify the upper/left and lower/right coordinates of the rectangular region to extract.   Alternatively, as we did in class, we can specify the starting x value and the x length, as well as the starting y value and the y length. Return a new image of the appropriate dimensions that contains only the cropped region. Name your routine cropRectangle. (not crop1)

Scale: Provide a scaling factor as a double. Multiply the dimensions by this factor to increase/decrease the height and width of the object. Expand or contract the pixels to create a new copy of the original image. Name your method scale.

Overlay: Place one image overtop of another. You should provide the (x,y) coordinates to specify the upper/left corner of the overlay position. If the overlain image extends beyond the boundaries of the underlying image, then ignore that portion of the overlain image and copy as much as is possible. Name your method overlay.

Transparent Overlay: Same as an overlay except that any pure black areas in the overlaying image ”bleed through” and pick up the underlying image below. Name your method transparentOverlay.

Circle Crop: Obviously you must create a rectangular image, but extract only a circular portion of the original image and make the outer boundaries of the square pure black (so it works especially well with a transparent overlay). Specify the center (x,y) and radius of the cropping. Name your method cropCircle.

Ellipse Crop: Remember an ellipse? Two centers and a constant sum of distances? This allows you to do oval croppings. Name your method cropEllipse.

Rotation: Specify the angle of rotation (in degrees) between 0 and 360 (actually allow any arbitrary angle including negative angles). Rotate the image counter clockwise in this many degrees. Name your method rotate.

Swirl: You can change the rotation routine above slightly so that the amount of rotation (degrees) changes as a function of the radius. This way some things are rotated more or less as they are farther away from the center points – creates a swirl effect. Name your method swirl

Carnival Mirror: Mirrors either distort horizontally or vertically but usually not both. So you can choose one or implement both. Consider the horizontal distortion: the vertical distances are all left unchanged. But the horizontal features are either expanded or compressed from the mid axis running vertically through the image. You can use a sine function to nicely imitate this gradual compression/expansion. Name your method carnivalMirror.

Out of bounds?: Many of these routines will create images that exceed the dimensions of the jpg file. If you need to put a pixel out of bounds, then obviously just ignore it (this part of the image will be omitted). See the Lance Armstrong image in my collage above – the corners are missing because after the rotation, they are ”off the bounds” of the image. There will be other instances where there is nothing beneath. Again see the Lance Armstrong image rotation above. There are ”white areas” left over after the image is rotated. Leave these areas as pure white.

Others: If you create your own image manipulation routines, then be sure to comment them extensively so that we know how to use them and what they are supposed to do.