{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

11MorePixelsByIndexNumber-noTemple

# 11MorePixelsByIndexNumber-noTemple - CS1315 Introduction to...

This preview shows pages 1–5. Sign up to view the full content.

CS1315: Introduction to Media Computation More referencing pixels directly by index number: Red eye and mirroring

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

View Full Document
Removing “Red Eye” When the flash of the camera catches the eye just right (especially with light colored eyes), we get bounce back from the back of the retina. Result: “red eye” We can replace the “red” with a color of our choosing. Find where the eyes are (x, y) using MediaTools
Removing Red Eye def removeRedEye(pic, startX, startY, endX, endY, replacementColor): red = makeColor (255, 0, 0) for x in range (startX, endX + 1): for y in range (startY, endY + 1): currentPixel = getPixel (pic, x, y) if ( distance (red, getColor (currentPixel)) < 165): setColor (currentPixel, replacementColor) What we’re doing here: Within the rectangle of pixels (startX, startY) to (endX, endY) Find pixels close to red, then replace them with a new color replacementColor Why use a range? Because we don’t want to replace her red dress!

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

View Full Document
“Fixing” it: Changing red to black removeRedEye(jenny, 109, 91, 202, 107, makeColor(0, 0, 0))
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 11

11MorePixelsByIndexNumber-noTemple - CS1315 Introduction to...

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

View Full Document
Ask a homework question - tutors are online