====================================================================== ===== COMP2720 ===== Semester 2, 2006 ===== Lab sheet ===== ====================================================================== Student name: Dean Dal Broi Student Uni ID: u4222206 Lab goup: Wed 10-12 Tutor: Peter Christen ---------------------------------------------------------------------- Lab number: Homework 1 Date: 16/9/06 ====================================================================== Have downloaded all required files, Moving onto part 1. Part 1. Q1. Have read the program blend.py and have understood it. It reads the two thailand pictures, Then it creates an empty canvas to put them in. It then copies the part of the first picture not included in the overlap into the empty canvas, It then puts the overlap section into the empty canvas. It calculates the color of the pixels for the overlap by taking 50% of each color value from the 2 original images and combining it to form 1 color. Then lastly the section of the second picture that is not included in the overlap is copied into the canvas. Q2. Created the blendBetter function, I also included and input for the 2 blend factors..eg you can choose to have 90% of picture 1 showing and only 10% of picture 2 in the blended section. The actual blended section of the new picture was difficult to achive, I had to add two 'If statements' into the main loop copying the blended section to ensure that if the first picture wasnt overlapping the second that only it was copied and vice versa. Q3. Ran the chromakey program with the 2 required pictures and noticed that it produced an ordinary result with alot of ocean floor remaining in the picuture and lots of the shark cut out. Q4. I modified the chromakey program to produce a much nicer result, the modification to the IF satatement is below: # Define blue: If the greenness < blueness if (getGreen(p)+10) < (getBlue(p)): # if theres alot of blue if ((getBlue(p)) > 100): # Then grab the pixel from the new background setColor(p, getColor(getPixel(bg,x,y))) Q5. Tried to run the chromokey program with the flow picuture an as expected it didnt work well because we should be looking to remove green and brow not blue. Thus I modified the contents of the main loop as below for the program to produce a desirable result: # Define background: If the redness < greenness if (getRed(p)) < (getGreen(p)): # Then grab the pixel from the new background setColor(p, getColor(getPixel(bg,x,y))) # Define background: If the theres alot of brown elif ((getBlue(p) + getGreen(p)) > (getRed(p))): # Then grab the pixel from the new background setColor(p, getColor(getPixel(bg,x,y))) Part 2. Q1. Have loaded and run the coolpic.py function, I then added comments to the code and then saved it. Q2. Created coolpicB by incrementing the position at which the rectangle was to be drawn at with each cycle of the loop Q3. Completed the 2 additional coolpics with commenting through the programs so they can be understood. Q4.The program produces a black image. This is because the rectangles are being drawn on black and thier border is black, thus we see nothing And easy fix would be to draw a filled white rectangle over the background. Q5. After fixing the program it produced the same image as figure 5.17 in the text book. Q6. Created a picture similar to the example picture. I used 4 separate loops to create the rectanges in each of the corners. and the the addText function for my name and the addLine function for the triangle. The code is commented and fairly self explanitory. Q7. Created a drawing using elements from the coolpics and from the myName pic, All code is commented. ======================================================================