Manipulate Picture >>> file = Users/guzdial/mediasources/katie.jpg >>> pict = makePicture(file) >>> show(pict) >>> setColor (getPixel(pict,10,100),yellow) >>> setColor (getPixel(pict,10,101),yellow) >>> setColor (getPixel(pict,10,102),yellow) >>> setColor (getPixel(pict,10,103),yellow) >>> setColor (getPixel(pict,10,104),yellow) >>> repaint(pict) Using Loops in Pictures >>> for pixel in getPixels(picture) value = getRed(pixel) setRed(pixel,value) >>> for pixel in getPixels(picture) value = getRed(pixel) setRed(pixel,value*0.5)
Using Loops in Picture Your Turn!!! Make sun set picture from beach picture. Assume that when sun set, blue and green will be decreased 30%. Negative Image which invert black and white of gray level. Grayscale image which computed by average of red, green and blue of each pixel. Looping Across the Pixels with range >>> for x in range(1,getWidth(picture)) for y in range(1,getHeight(picture)) pixel = getPixel(picture,x,y)
Your Turn!!! Let lighten the picture. Mirror your image vertical or horizontal. Copying and Transforming Image #Set up the source and target pictures barbf = getMediaPath(babara.jpg) barb = makePicture(barbf) canvasf = getMediaPath(7inx95in.jpg) canvas = makePicture(canvasf) targetX = 1 for sourceX in range(1,getWidth(barb)): targetY = 1 for sourceY in range(1,getHeight(barb)): color = getColor(getPixel(barb,sourceX,sourceY)) setColor(getPixel(canvas,targetX,targetY),color) targetY = targetY + 1 targetX = targetX + 1 show(barb) show(canvas)
Copying and Transforming Pictures Your Turn!! Translation with (10,15) Rotate CW 90 degree. Scale up by 2 Scale down by 2 Blurring Sharpening Blue Screen
Please collect the completed tests and place them in the folder labeled “Completed Tests.” I will score themand record the results. Thank you for your help administering this assessment