Multimedia Summer Camp

Slides:



Advertisements
Similar presentations
ManipulatingPictures-Mod6-part21 Manipulating Pictures, Arrays, and Loops part 2 Barb Ericson Georgia Institute of Technology.
Advertisements

01-IntroToMediaComp1 Barb Ericson Georgia Institute of Technology Oct 2010 Introduction to Computer Science and Media Computation.
Fourteen lists and compound data. Some primitive data types Integers (whole numbers) 1, 2, 3, -1, 0, , etc. “Floating-point” numbers ,
James Tam Programming: Part II In this section of notes you will learn about more advanced programming concepts such as looping, functions.
Twelve painting with procedures. Overview Making shaded images with procedures Making a more elegant language Making textures with noise functions.
Copying and Transforming Pictures. First, finding the min or max… Next homework asks you to write a function to find the darkest and lightest shade of.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 3: Modifying Pictures using Loops.
+ Introduction to Programming My first red-eye removal.
CS 102 Computers In Context (Multimedia)‏ 01 / 28 / 2009 Instructor: Michael Eckmann.
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.
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.
CS2984: Introduction to Media Computation Using Loops for Pictures Conditionals Copying images.
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 3: Modifying Pictures using Loops.
CS 101: Introduction to Computing Color replacements and targeted color replacement (if statement) Developed by Mark Guzdial, Georgia Institute of Technology,
ManipulatingPictures-Mod6-part61 Manipulating Pictures, Arrays, and Loops: Eliminating color, Inversion, grey scale and adjusting for luminance Barb Ericson.
Chapter 5: Advanced Picture Techniques (partial deck)
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 3: Modifying Pictures using Loops.
01-IntroToMediaComp1 Barb Ericson Georgia Institute of Technology Feb 2010 Introduction to Computer Science and Media Computation.
CPSC1301 Computer Science 1 Chapter 4 Manipulating Pictures, Arrays, and Loops part 5.
CS1315: Introduction to Media Computation Color replacements and targeted color replacement (IF)
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,
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
CS1315: Introduction to Media Computation Using Loops for Pictures.
Chapter 3: Modifying Pictures using Loops. Chapter Learning Objectives.
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.
CS 101: Introduction to Computing Programs that change Pictures Developed by Mark Guzdial, Georgia Institute of Technology, 2003–2004; modified by Robert.
Python: Working with pixels. Reminder: Conditionals if age < 18: showInformation(“Sorry, not allowed to vote yet.”) else: showInformation(“Please select.
1 CS 177 Week 7 Recitation Slides Modifying Sounds using Loops + Discussion of some Exam Questions.
ManipulatingPictures-part31 Manipulating Pictures, Arrays, and Loops part 3 Barb Ericson Georgia Institute of Technology Nov 2009.
Intro CS and Media Computation1 Barb Ericson Georgia Institute of Technology Feb 2010 Introduction to Computer Science and Media Computation.
CS1315: Introduction to Media Computation Making sense of functions.
1 CS 177 Week 4 Recitation Slides for Loop if statement and range.
Problems With Assistance Module 2 – Problem 4
More about comments Review Single Line Comments The # sign is for comments. A comment is a line of text that Python won’t try to run as code. Its just.
- Introduction - Graphics Pipeline
Chapter 4: Modifying Pictures using Loops
Foundations of Physical Science
Image Manipulation Institute for Personal Robots in Education (IPRE)‏
Topic 6 Modifying Pictures Using Loops
EasyCode Foundations Vocabulary Terms.
CSC 108H: Introduction to Computer Programming
Multimedia Summer Camp
Topic 10 The if statement Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson,
painting with procedures
CS451Real-time Rendering Pipeline
Learning to program with Logo
Manipulating Pictures, Arrays, and Loops
How to Start This PowerPoint® Tutorial
Functions BIS1523 – Lecture 17.
Manipulating Pictures, Arrays, and Loops part 5
Chapter 4: Modifying Pictures using Loops
Chapter 3: Modifying Pictures using Loops
CS1315: Introduction to Media Computation
Chapter 3: Modifying Pictures using Loops
Agenda – 1/31/18 Questions? Group practice problems
A Media Computation Cookbook
Image Manipulation Institute for Personal Robots in Education (IPRE)‏
Technique 6: General gray-level transformations
Image Manipulation Institute for Personal Robots in Education (IPRE)‏
Technique 6: General gray-level transformations
Manipulating Pictures, Arrays, and Loops part 6
CS 177 Week 3 Recitation Slides
Chapter 3: Modifying Pictures using Loops
CS1315: Introduction to Media Computation
Vocabulary Memory Cards--Sample
CS1315: Introduction to Media Computation
CSC1401 Manipulating Pictures 2
CSIS110 - Introduction to Computer Science
Presentation transcript:

Multimedia Summer Camp Using Loop for Pictures

For-loop A for loop executes some commands (that you specify) for a sequence (that you provide) Each time the commands are executed, a particular variable (that you name) will have the value of a different element of the sequence. A sequence is an ordered collection of data.

For-loop syntax: for variable_you_named in sequence_you_provided : a_block_of_commands_you_specified

Example def decreaseRed(picture): for p in getPixels(picture): value = getRed(p) setRed(p, value*0.5) p is the name of the variable getPixels is a function provided by Jython to return the sequence of Pixel objects in the given picture. Last two statements are commands to be executed for each pixel in the picture

Example Once we make it work for one picture, it will work for any picture.

What if you decrease Santa’s red again and again and again…?

Increase Red What happened here?!? Remember that the limit for redness is 255. If you could go beyond 255, all kinds of weird things can happen

Increase Red Remember that the limit for redness is 255. So even if you try to go beyond 255, JES will set the level to 255 max. These blotches won’t happen :)

How does increaseRed differ from decreaseRed? Well, it does increase rather than decrease red, but other than that… It takes the same parameter input It can also work for any picture It’s a specification of a process that’ll work for any picture There’s nothing specific to any particular picture here.

Clearing Blue Again, this will work for any picture. Try stepping through this one yourself!

Can we combine these? Why not! How do we turn this beach scene into a sunset? What happens at sunset? At first, I tried increasing the red, but that made things like red specks in the sand REALLY prominent. That can’t be how it really works New Theory: As the sun sets, less blue and green is visible, which makes things look more red.

A Sunset-generation Function

Creating a negative A positive image is a normal image. A negative image is a total inversion of a positive image, in which light areas appear dark and vice versa. Let’s think it through R, G, B go from 0 (low) to 255 (high) Let’s say Red is 10. That’s very light red. What’s the opposite? LOTS of Red! The negative of that would be 245: 255-10 So, for each pixel, if we negate each color component in creating a new color, we negate the whole picture.

Creating a negative

Original, negative, double negative This gives us a quick way to test our function: Call it twice and see if the result is equivalent to the original

Converting to grayscale When red=green=blue then the color is a shade of gray But what value do we set all three to? What we need is a value representing the darkness of the color, the luminance Simple way is to take the average of R, G, B:

Converting to grayscale

Why can’t we get back again? Converting to a negative is reversible. A negative transformation retains information. Converting to grayscale is not reversible, we’ve lost information We no longer know what the ratios are between the reds, the greens, and the blues We no longer know any particular value.