Chapter 5: Advanced Picture Techniques (partial deck)

Slides:



Advertisements
Similar presentations
+ Introduction to Programming My first red-eye removal.
Advertisements

Introduction to compositing. What is compositing?  The combination of two images to produce a single image  Many ways we can do this, especially in.
Conditionals-part31 Conditionals – part 3 Barb Ericson Georgia Institute of Technology Nov 2009.
Photography and CS Philip Chan. Film vs Digital Camera What is the difference?
Objectives Understand grayscale Investigate a grayscale image
© red ©
Photoshop Basics, Part 2 Topics to be covered Photo enhancement & retouching Creating font images.
Computer Vision. How would a human think of this picture? We might think of this picture as something like “an orange smiley face with black eyes, lighter.
CS 1 with Robots Image Manipulation Institute for Personal Robots in Education (IPRE)‏
Color Model AbdelRahman Abu_absah Teacher: Dr. Sana'a Alsayegh.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 5: Advanced Picture Techniques.
+ Introduction to Programming My first red-eye removal.
Digital Images The digital representation of visual information.
Picture Color Manipulation. Using a Loop Our first picture recipe def decreaseRed(picture): for p in getPixels(picture): value=getRed(p) setRed(p,value*0.5)
CS 101: Introduction to Computing Programming picture manipulations Developed by Mark Guzdial, Georgia Institute of Technology, 2003–2004; modified by.
Color Correct and Remove Keystoning A minimalist approach to photographing your art By Paul Marley.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
Replacing colors using if We don’t have to do one-to-one changes or replacements of color We can use if to decide if we want to make a change.  We could.
Bringing some focus to your photos.  “You Press The Button and We Do The Rest."  Now, you press the button and the camera does the rest.  Versatile,
Manipulating Pixels by Range and More on Functions.
CS2984: Introduction to Media Computation Using Loops for Pictures Conditionals Copying images.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
1 Printing & Imaging Technology Digital Photo Retouching: Quick Fixes for Digitally Captured Photographs Copyright © Texas Education Agency, All.
CS 101: Introduction to Computing Color replacements and targeted color replacement (if statement) Developed by Mark Guzdial, Georgia Institute of Technology,
03-ConditionalsInPictures Barb Ericson Georgia Institute of Technology Feb 2010 Working with ranges in pictures.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 5: Advanced Picture Techniques.
Chapter 5: Advanced Picture Techniques. Chapter Objectives.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 3: Modifying Pictures using Loops.
COLOR.
CS1315: Introduction to Media Computation Color replacements and targeted color replacement (IF)
CSC1401 Using Decisions in Java - 1. Recall from Alice We only wanted to shoot a lightning bolt at a philosopher So, we used the If statement.
TOPIC 10 THE IF STATEMENT 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson,
ITEC 109 Multimedia Lecture Lecture 23. Photo manipulation Review Lists / Arrays.
Yet Another Version. More Careful Edge Detection def lineDetect(filename): orig = makePicture(filename) makeBw = makePicture(filename) for x in range(0,getWidth(orig)-1):
CS1315: Introduction to Media Computation Using Loops for Pictures.
A Media Computation Cookbook Manipulating Images and Sounds for Use in Alice Part 1: Image Manipulations Part 2: Changing colors in an area Part 3: Chromakey.
A Media Computation Cookbook Manipulating Images and Sounds for Use in Alice Part 1: Image Manipulations Part 2: Advanced Image Manipulations, e.g., changing.
How to make a picture in black and white Mass Media Mr. Guzman 1st period.
CS 101: Introduction to Computing Programs that change Pictures Developed by Mark Guzdial, Georgia Institute of Technology, 2003–2004; modified by Robert.
PART TWO Electronic Color & RGB values 1. Electronic Color Computer Monitors: Use light in 3 colors to create images on the screen Monitors use RED, GREEN,
Understanding Color Correction Outline  Color Casts Defined  Channels Defined  Auto Methods of Color Correction-- Levels  Manual Methods of Color Correction--
Python: Working with pixels. Reminder: Conditionals if age < 18: showInformation(“Sorry, not allowed to vote yet.”) else: showInformation(“Please select.
More Digital Representation Discrete information is represented in binary (PandA), and “continuous” information is made discrete.
CS1315: Introduction to Media Computation Making sense of functions.
1 CS 177 Week 4 Recitation Slides for Loop if statement and range.
CASTLEFORD CAMERA CLUB
Image Manipulation Institute for Personal Robots in Education (IPRE)‏
Topic 10 The if statement Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson,
CS1315: Introduction to Media Computation
Images Presentation Name Course Name Unit # – Lesson #.# – Lesson Name
Barb Ericson Georgia Institute of Technology August 2005
Workshop for Programming And Systems Management Teachers
CS1315: Introduction to Media Computation
Removing Color Casts in GIMP
Art Programs Raise Deep Questions
A Media Computation Cookbook
Image Manipulation Institute for Personal Robots in Education (IPRE)‏
Images Presentation Name Course Name Unit # – Lesson #.# – Lesson Name
Colors Computers build colors from Red, Green, and Blue; not Red, Blue, and Yellow. RGB = Red Green Blue Creating Colors Red + Blue = Purple No Red, No.
Georgia Institute of Technology
Image Manipulation Institute for Personal Robots in Education (IPRE)‏
What Color is it?.
CS 101: Introduction to Computing
CS1315: Introduction to Media Computation
Basic Concepts of Digital Imaging
Multimedia Summer Camp
CS1315: Introduction to Media Computation
Presentation transcript:

Chapter 5: Advanced Picture Techniques (partial deck)

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. This results in “red eye” We can replace the “red” with a color of our choosing. First, we figure out 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): for y in range(startY,endY): 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 Why use a range? Because we don’t want to replace her red dress!

“Fixing” it: Changing red to black removeRedEye(jenny, 109, 91, 202, 107, makeColor(0,0,0)) Jenny’s eyes are actually not black—could fix that Eye are also not mono- color A better function would handle gradations of red and replace with gradations of the right eye color

Replacing colors using IF We don’t have to do one-to-one changes or replacements of color We can use if to decide if we want to make a change. We could look for a range of colors, or one specific color. We could use an operation (like multiplication) to set the new color, or we can set it to a specific value. It all depends on the effect that we want.

Posterizing: How we do it We look for a range of colors, then map them to a single color. If red is between 63 and 128, set it to 95 If green is less than 64, set it to It requires a lot of if statements, but it’s really pretty simple. The end result is that a bunch of different colors, get set to a few colors.

The recipe converts colors of a luminance of less than 85 to blue, colors of luminance between 86 and 150 to orange, and the rest of the colors to yellow. The image at the bottom was produced with such a reciple from the image at the top.

Posterizing to b/w levels def grayPosterize(pic): for p in getPixels(pic): r = getRed(p) g = getGreen(p) b = getBlue(p) luminance = (r+g+b)/3 if luminance < 64: setColor(p,black) if luminance >= 64: setColor(p,white) We check luminance on each pixel. If it’s low enough, it’s black, and Otherwise, it’s white

Generating sepia-toned prints Pictures that are sepia-toned have a yellowish tint to them that we associate with older pictures. It’s not directly a matter of simply increasing the yellow in the picture, because it’s not a one-to-one correspondence. Instead, colors in different ranges get mapped to other colors. We can create such a mapping using IF

Example of sepia-toned prints

Here’s how we do it def sepiaTint(picture): #Convert image to greyscale greyScaleNew(picture) #loop through picture to tint pixels for p in getPixels(picture): red = getRed(p) blue = getBlue(p) #tint shadows if (red < 63): red = red*1.1 blue = blue*0.9 #tint midtones if (red > 62 and red < 192): red = red*1.15 blue = blue*0.85 #tint highlights if (red > 191): red = red*1.08 if (red > 255): red = 255 blue = blue*0.93 #set the new color values setBlue(p, blue) setRed(p, red)

What’s going on here? First, we’re calling greyScaleNew (the one with weights). It’s perfectly okay to have one function calling another. We then manipulate the red (increasing) and the blue (decreasing) channels to bring out more yellows and oranges. Why are we doing the comparisons on the red? Why not? After greyscale conversion, all channels are the same! Why these values? Trial-and-error: Twiddling the values until it looks the way that you want.