cs151s10proj5(Philip Prosapio)
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Philip Prosapio
Spring 2010

The first task that we needed to completed was to create a function buildCollage() that would make a collage that has multiple pictures in it, and with new effects and different element. I then made a function putPixmapNoBlue() that does the same this as the putPixmap() function that we made last lab except that this new function won't transfer the blue background of the blue screen photos we use. We were then tasked to edit our buildCollage() function so that the sixth element in the collage information list would determine which function between putPixmap() and putPixmapNoBlue() to use. We then had to run our buildCollage() function with four photos in it. In the final task we needed to make another collage in which the pictures were placed in a triangular configuration.

Description of Solution

1) For the first task I followed the instructions on the website and created the buildCollage() function. For this task the key thing was to make sure each item in the collage information list was assigned to a different variable so it could be used later in the function.

for item in clist:
filename = item0
x0 = item1
y0 = item2
operator = item3
alpha = item4
useChromakey = item5
source = item-1

2)For the second task, I had to find a way to make it so the blue background would not be added into the collage, so I added an if statement to get this accomplished. I had python compare the blue values of each pixel to determine which pixels to bring in.

if b1 < 2*r1:
destination.setPixel(x+i, y+j, (r1*alpha + (1.0-alpha)*r2,
g1*alpha + (1.0-alpha)*g2, b1*alpha + (1.0-alpha)*b2))

Also notice the alpha's that are in this code snippet. These affect the blending of the pictures into the collage.

3) The third task just required me to add in an if and else statement to determine what put pixmap function I wanted to be executed.

if useChromakey:
putPixmapNoBlue(destination, source, x0, y0, alpha)
putPixmap(destination, source, x0, y0, alpha)

So if I entered True then it would run putPixmapNoBlue(), and if I entered False it would run putPixmap().

4) In the fourth task, I took four pictures, three from the lab and the other was the blue screen picture of me, and plugged them into the collage information list that the function buildCollage() is based off of.

clist = [ [ argv1, 0, 0, 'rbswap', 0.8, False, None ],
[ argv2, 25, 150, 'original', 1.0, True, None ],
[ argv3, 0, 150, 'rgswap', 0.5, False, None],
[ argv4, 150, 50, 'ynegate', 0.3, False, None]]

As you can tell, in each list contains the information of the filename, x and y location, what function to use on the file, the alpha blend number, my newly created put pixmap indicator, and finally the string None which is a place holder of sorts. The picture of this function is attached and is named picture1lab5.png .

5) The final task that required us to make a collage in the shape of a triangle was similar to the last task, but with a little more specifications of where to place each photo needed. By finding the height and width of the first image, I was able to place the other to images in the correct locations to make the triangle configuration.


  • No labels