Computer Science 101 Introduction to Programming with Pictures.

Slides:



Advertisements
Similar presentations
In our lesson today we will learn how to find the area of a building.
Advertisements

Python: Modifying Pictures Using Loops. Review JES command area – program area Defining/using functions specifying a sequence of steps for what the function.
Computer Science 111 Fundamentals of Programming I More Digital Image Processing.
Python: Making colors and Using Loops. Review JES command area – program area Defining/using functions specifying a sequence of steps for what the function.
GUI and Swing, part 2 The illustrated edition. Scroll bars As we have previously seen, a JTextArea has a fixed size, but the amount of text that can be.
CS 102 Computers In Context (Multimedia)‏ 03 / 20 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 02 / 25 / 2009 Instructor: Michael Eckmann.
CSE 113 Week 5 February , Announcements  Module 2 due 2/15  Exam 3 is on 2/15  Module 3 due 2/22  Exam 4 is on 2/25  Module 4 due 2/29.
CS 1 with Robots Image Manipulation Institute for Personal Robots in Education (IPRE)‏
TOPIC 9 MODIFYING PIXELS IN A MATRIX: COPYING, CROPPING 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
Picking. What is picking? Selecting an object on the screen What does this require? –Get Mouse Location –Compute what objects are rendered at the position.
Image Processing & Perception Sec 9-11 Web Design.
CS 101: Introduction to Computing Programming picture manipulations Developed by Mark Guzdial, Georgia Institute of Technology, 2003–2004; modified by.
COSC 1P02 Intro. to Computer Science 6.1 Cosc 1P02 Week 6 Lecture slides "To succeed, jump as quickly at opportunities as you do at conclusions." --Benjamin.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
Chapter 6: Modifying Pixels by Position. Chapter Learning Goals.
COMPREHENSIVE Windows Tutorial 7 Managing Multimedia Files.
CS1315: Introduction to Media Computation Referencing pixels directly by index number.
Computer Science 112 Fundamentals of Programming II Graphics Programming.
COSC 1P02 Introduction to Computer Science 7.1 Cosc 1P02 Week 7 Lecture slides "There are two ways of constructing a software design; one way is to make.
Chapter 15Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 15 l Basic Figures l Colors l Fonts and Other Text Details.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
1 CS 177 Week 5 Recitation Slides Mirroring and copying images, Using for Loop, if statement, and range.
7.1 Area of a Region Between Two Curves. Consider a very thin vertical strip. The length of the strip is: or Since the width of the strip is a very small.
A Media Computation Cookbook Manipulating Images and Sounds for Use in Alice Part 1: Image Manipulations Part 2: Advanced Image Manipulations, e.g., changing.
CS1315: Introduction to Media Computation Transforming pictures by index number.
Python: Working with pixels. Reminder: Conditionals if age < 18: showInformation(“Sorry, not allowed to vote yet.”) else: showInformation(“Please select.
1 Sections 5.1 – 5.2 Digital Image Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
CompSci 4 Java 4 Apr 14, 2009 Prof. Susan Rodger.
Week 6 Drafting 1309: Basic CAD Andrew Amini Professor Drafting and Design Engineering Technology, HCC.
Test 2 on Wed, 11/9 On image processing
Hitting the Refresh Button
CMSC5711 Image processing and computer vision
David Meredith Aalborg University
Today, we'll learn how to animate our artwork
Pixels, Colors and Shapes
Topic 9 Modifying Pixels in a Matrix: Copying, Cropping
“ – Attribution (Difficult) Animated snow scene
Image Manipulation Institute for Personal Robots in Education (IPRE)‏
Multimedia Summer Camp
Image Processing & Perception
Lesson One: The Beginning Chapter 1: Pixels Learning Processing Daniel Shiffman Presentation by Donald W. Smith Graphics from
Animated picture fades from gray to color (Basic)
“Placeholder for a quote to be animated here.”
CMSC5711 Image processing and computer vision
Test 2 on Wed, 11/9 On image processing
“Keep looking up…that’s the secret of life.”
“It is only those who never do anything who never make mistakes.”
Geb Thomas Adapted from the OpenGL Programming Guide
Монголын ноосон бүтээгдэхүүн үйлдвэрлэгчдийн холбоо
CSc 110, Spring 2018 Lecture 9: Parameters, Graphics and Random
Faded picture background with full-color overlay (Intermediate)
Gray Scale picture def pixBW(pixel): # given a pixel, change to BW
… a white peppermint world as far as the eye could see…
Week 3.
Darkened picture background with full-color circle (Intermediate)
Agenda: 1) Quick Write 2) Finish Questions Ch
ALASKA How did the U.S. acquire Alaska?
Fundamentals of Programming I Introduction to Digital Image Processing
Image Manipulation Institute for Personal Robots in Education (IPRE)‏
Pictures with checkerboard shutter animation (Intermediate)
Windows Tutorial 7 Managing Multimedia Files
Pictures in 3-D flip book (Intermediate)
The work of moving ice Chapter 8 Animated snow scene (Difficult)
Image Manipulation Institute for Personal Robots in Education (IPRE)‏
CS 177 Week 3 Recitation Slides
CS 101: Introduction to Computing
The coordinate system Susan Ibach | Technical Evangelist
Presentation transcript:

Computer Science 101 Introduction to Programming with Pictures

setMediaPath Invoking this function allows the user to choose a folder that will be the “default” location where searches for media files will start. This just makes it easier to pick files, etc. Invoking this function allows the user to choose a folder that will be the “default” location where searches for media files will start. This just makes it easier to pick files, etc.

JES Picture Layout With JES, pictures are laid out in an x,y coordinate system starting in upper left corner, with x increasing to the right and y increasing downward. With JES, pictures are laid out in an x,y coordinate system starting in upper left corner, with x increasing to the right and y increasing downward.

Working with Pixels – get values getPixel(picture,x,y) – obtains the pixel at the given coordinates in the given picture. getPixel(picture,x,y) – obtains the pixel at the given coordinates in the given picture. getColor(pixel) – obtains the color object of the pixel. getColor(pixel) – obtains the color object of the pixel. getRed(pixel) – obtains the red value of the pixel, etc. getRed(pixel) – obtains the red value of the pixel, etc. getX(pixel) – obtains the X coordinate of the pixel, etc. getX(pixel) – obtains the X coordinate of the pixel, etc.

Working with Pixels – changing values setColor(pixel, color) – changes the pixel’s color to be the given color. setColor(pixel, color) – changes the pixel’s color to be the given color. setRed(pixel, redAmt) – changes the pixel’s red value to the given amount, etc. setRed(pixel, redAmt) – changes the pixel’s red value to the given amount, etc. pickAColor() – lets the user choose a color with slide bars, etc. pickAColor() – lets the user choose a color with slide bars, etc.

ZOOM

List of Pixels getPixels(myPicture) - returns a list of all the pixels from the picture. getPixels(myPicture) - returns a list of all the pixels from the picture. The pixels will be in the list in row order – first row followed by second row, etc. The pixels will be in the list in row order – first row followed by second row, etc. Note that the pixel in position (x,y) has list index equal to width * y + x For example, the pixel at (3,2) has index 2*4 + 3 Note that the pixel in position (x,y) has list index equal to width * y + x For example, the pixel at (3,2) has index 2*4 + 3

Changing Individual Pixels 1. Get the pixel into a variable: myPixel = getPixel(myPicture,10,6) 2. If the change does not depend on current values in the pixel, make change: setRed(myPixel, 128) 3. If change depends on current values, get the needed values first: myRed = getRed(myPixel) setRed(myPixel, myRed * 0.5)

Processing all the Pixels The general strategy is to use a for-loop on the list of pixels: thePixels = getPixels(thePicture) for aPixel in thePixels : or for aPixel in getPixels(thePicture) : The general strategy is to use a for-loop on the list of pixels: thePixels = getPixels(thePicture) for aPixel in thePixels : or for aPixel in getPixels(thePicture) :

Choosing Pixels to Process Sometimes we decide which pixels to process or which process to apply depending on conditions on the pixels thePixels = getPixels(thePicture) for aPixel in thePixels: if Sometimes we decide which pixels to process or which process to apply depending on conditions on the pixels thePixels = getPixels(thePicture) for aPixel in thePixels: if

Working with Pixels within a Region Often we can restrict our processing to pixels within some rectangular region of the picture. This can be much, much more efficient than iterating over all of the multitude of pixels. for x in range(a,b) : for y in range(c,d) : Often we can restrict our processing to pixels within some rectangular region of the picture. This can be much, much more efficient than iterating over all of the multitude of pixels. for x in range(a,b) : for y in range(c,d) :

Parameter for Color

Add Parameters for Width, Height, and Starting Point

Negative

Lighten

GrayScale

Sepia Tint

Rotate 90

Copy Rectangle

Edge Detection

Blend

Frame