Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 102 Computers In Context (Multimedia)‏ 02 / 25 / 2009 Instructor: Michael Eckmann.

Similar presentations


Presentation on theme: "CS 102 Computers In Context (Multimedia)‏ 02 / 25 / 2009 Instructor: Michael Eckmann."— Presentation transcript:

1 CS 102 Computers In Context (Multimedia)‏ 02 / 25 / 2009 Instructor: Michael Eckmann

2 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Today’s Topics Questions/comments (from Lab sessions)? Chapter 4 –Continue Modifying pixels in a range –Copy pixels from one image to another (w/offsets)‏ –Blend two pictures together

3 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Loops to go through all pixels Let's review code to simply go through all the pixels in an image. def pictureFun(picture): for row in range(1, getHeight(picture)+1): for col in range(1, getWidth(picture)+1): aPixel = getPixel(picture, col, row)‏ # code here to do something to aPixel Just out of curiosity, what order will the pixels be processed above (row-by-row or column-by-column)?

4 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Media Tools and the Gimp In JES we will use setMediaPath first to set the path to where all my images are. This will make pickAFile() immediately show the directory I want. Let's look at how we can use “MediaTools” as well as the Gimp to allow us to get information about images (their height, width, coordinates of particular pixels, color values of particular pixels, etc.). Also, let's create a couple of “blank” white pictures in the Gimp the same size as: –boatSmall.jpg and the eiffel tower image.

5 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Talk today at 5:30p.m. What & Who: –Unfolding Polyhedra by Dr. Robin Flatland of the Computer Science Dept., Siena College When: –Wednesday, February 25, 5:30 PM Where: –Davis Auditorium Refreshments will be served Sponsored by the Mathematics & Computer Science Dept., Honors Forum, and Pi Mu Epsilon

6 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Copying colors from one image to another. Let's look at how we can “copy” pixels from one image to another. Let's just copy the full boatSmall.jpg into the “blank” image. How about copying just the moon from the moonTangSmall.jpg into a blank image.

7 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Blending colors from two images into another. We know that there are red green and blue components of each pixel in a color image. Can anyone think of a way to take two pixels (one each from a different image) and blend them together into another color?

8 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Blending colors from two images into another. Let's try to blend the boatSmall.jpg and the moonTangSmall.jpg into the “blank” image. Let's look at the eiffel image and the arch image in MediaTools and try to get the arch and eiffel tower lined up and blended together. What if we wanted to put the eiffel tower and the arch in the upper left corner of the output image?

9 Michael Eckmann - Skidmore College - CS 102 - Spring 2009 Some JES image functions makePicture getWidth, getHeight getPixel getPixels getX, getY getRed, getBlue, getGreen setRed, setBlue, setGreen distance getColor, setColor, makeColor pickAColor makeLighter, makeDarker writePictureTo show


Download ppt "CS 102 Computers In Context (Multimedia)‏ 02 / 25 / 2009 Instructor: Michael Eckmann."

Similar presentations


Ads by Google