====================================================================== ===== COMP2720 ===== Semester 2, 2006 ===== Lab sheet ===== ====================================================================== Student name: Dean Dal Broi Student Uni ID: u4222206 Lab goup: Tue 10-12 Tutor: Peter Christen ---------------------------------------------------------------------- Lab number: 2 Date: 9/8/06 ====================================================================== Downloaded all required files from comp2720 webpage and ready to go for the lab. Part 1 Ran the halfAndCopy function. The function asks for a media path, it then takes the picture flower400x400.jpg from that path. it then prints out that picture and scales its size down by half and prints that column by column on a new canvas. Majorly commented the function to increase my understanding of its operation. Made the halfAndCopy function into halfAndDouble by adding the following line of code into the loop that creates a new column: setColor(getPixel(targetPict, targetX + getWidth(sourcePict)/2, targetY), color) #set the color of the duplicated pixel in the source picture so this creates a new column halfway through the blank picture. Created quarterAndCopy, did this by modifying halfAndCopy to read every 4th column and every 4th row from the source picture. The quality of the picture is also decreased as the pixels are not being averaged thus we are loosing lots of data from the original picture. Created halfAndCenter, did this by modifying the target picture to be 400x400, and then to start creating the new pixels in the target at 100,100 which is 1/4 of the original image width and 1/4 of the original image height. Modified the halfAndCenter function to allow it to be run on the same picture twice, it results in the original picture be scaled down twice and thus you have a very small picture returned. Added the save function to halfAndCenter so that the picture is saved to the file modifiedPic.jpg in the media path that is set at the beginning of the function. Part 2. Loaded and ran the blur.py program. Noticed that it did in fact do what it was suppost to, that was bluring the original image. Created the blurSquare function by modifying the blur function to read an extra 4 pixels and take those into consideration when creating the new color for each blured pixel. Created the blurLargeCross function by slightly modifying my blurSquare function to chage the places where the 4 extra pixels are read from, I also had to modify the loops as follows: for x in range(3,getWidth(source)-1): for y in range(3,getHeight(source)-1): The original blur function only does a very basic blur that can be hard to notice, the square blur function improves on this and produces a more easily notice outcome. However the LargeCross blur function produces an outcome that is very noticable. Have had a look at the line detect function and have commented the code to explain how it works. I then played around with the threshold values placing different values for each condition, only to notice that it changes where the black pixels are placed. I then found a set of threshold values that I liked, 10 and 10 and saved a picture from running the function with those values. ======================================================================