rec5 - 1 CS 177 Week 5 Recitation Slides Mirroring and...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 CS 177 Week 5 Recitation Slides Mirroring and copying images, Using for Loop, if statement, and range 2 Announcements EXAM 1 Wednesday 09/29 6:30p - 7:30p EE 129 3 ANY QUESTIONS? Horizontal mirror recipe mirroring means intuitively "flipping around" an axis (when you mirror horizontally, you flip your picture around a vertical axis) STEP 1. Since the picture is represented by a matrix, you must determine the coordinates (x and y) of all the "points" of this axis in the matrix STEP 2. Then you have to determine the direction of the flipping (when you mirror horizontally, you may flip the left side to right side or vice versa) STEP3. Now, since pictures are encoded as a matrices, you must figure out where a pixel of the source picture should go in the target picture 4 Step 1- determine the mirror axis Step 2 - determine the flipping direction 5 1 2 Work it out with matrices To find out the mirror axis you need just to determine its x coordinate (the mirrorPoint). It is is halfway across: getWidth(picture)/2 6 Work it out with matrices STEP 2. If the flipping direction is left to right, then the source and target matrices will look like this: 7 Step 3 Figure out where a pixel of the source picture should go in the target picture 8 If source pixel is at (x,y), target pixel is at (width-x-1,y) Recipe for vertical mirroring def mirrorVertical(source): mirrorPoint = getWidth(source) / 2 width = getWidth(source)...
View Full Document

This note was uploaded on 02/22/2012 for the course CS 177 taught by Professor Staff during the Fall '08 term at Purdue.

Page1 / 26

rec5 - 1 CS 177 Week 5 Recitation Slides Mirroring and...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online