CS 102 Computers In Context (Multimedia)‏ 01 / 28 / 2009 Instructor: Michael Eckmann.

Slides:



Advertisements
Similar presentations
Speed CS A109. Big speed differences Many of the techniques we’ve learned take no time at all in other applications Select a figure in Word. –It’s automatically.
Advertisements

CS 206 Introduction to Computer Science II 01 / 20 / 2009 Instructor: Michael Eckmann.
Python: Modifying Pictures Using Loops. Review JES command area – program area Defining/using functions specifying a sequence of steps for what the function.
TOPIC 5 INTRODUCTION TO PICTURES 1 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B.
CS 206 Introduction to Computer Science II 04 / 28 / 2009 Instructor: Michael Eckmann.
Fundamentals of Digital Imaging
CS 102 Computers In Context (Multimedia)‏ 02 / 06 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 03 / 20 / 2009 Instructor: Michael Eckmann.
Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.
CS 102 Computers In Context (Multimedia)‏ 04 / 08 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 02 / 18 / 2009 Instructor: Michael Eckmann.
CS 330 Programming Languages 10 / 14 / 2008 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 04 / 20 / 2009 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 01 / 21 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 04 / 01 / 2009 Instructor: Michael Eckmann.
CS 330 Programming Languages 10 / 11 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 01 / 29 / 2008 Instructor: Michael Eckmann.
CS 376b Introduction to Computer Vision 03 / 26 / 2008 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 02 / 02 / 2009 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 21 / 2008 Instructor: Michael Eckmann.
CS430 © 2006 Ray S. Babcock CS430 – Image Processing Image Representation.
CS 106 Introduction to Computer Science I 04 / 09 / 2008 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 19 / 2008 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 03 / 25 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 02 / 25 / 2009 Instructor: Michael Eckmann.
CSC Computing with Images1 Image encodings CSC 1040.
CS 206 Introduction to Computer Science II 01 / 23 / 2009 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 17 / 2008 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 04 / 07 / 2010 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 01 / 26 / 2007 Instructor: Michael Eckmann.
Digital Images The digital representation of visual information.
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
CS 101: Introduction to Computing Programming picture manipulations Developed by Mark Guzdial, Georgia Institute of Technology, 2003–2004; modified by.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
Lecture # 27 Python I. Python “Interpretive” language (vs. compiled) So is HTML, JavaScript. Python supports file I/O. JavaScript doesn’t Python is a.
Color. There are established models of color, each discipline uses it own method for describing and discussing color intelligently.
CS 102 Computers In Context (Multimedia)‏ 01 / 23 / 2009 Instructor: Michael Eckmann.
CS 325 Introduction to Computer Graphics 02 / 01 / 2010 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 19 / 2007 Instructor: Michael Eckmann.
Python programming Introduction to the JES environment and basics of Python Reading: Chapters 1, 2 from “Introduction to Computing and Programming in Python”
CS 376b Introduction to Computer Vision 02 / 08 / 2008 Instructor: Michael Eckmann.
Pictures Looping through pixels.. Lab Review (1) Objects  Instantiated from Class  Turtle myTut = new Turtle(myWorld);  new operator creates an instance.
CSC Computing with Images
CS 330 Programming Languages 10 / 07 / 2008 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 01 / 26 / 2009 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 01 / 31 / 2007 Instructor: Michael Eckmann.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
Ch 6 Color Image processing CS446 Instructor: Nada ALZaben.
CS 102 Computers In Context (Multimedia)‏ 03 / 30 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 02 / 09 / 2009 Instructor: Michael Eckmann.
CS 376b Introduction to Computer Vision 02 / 11 / 2008 Instructor: Michael Eckmann.
CS 325 Introduction to Computer Graphics 04 / 12 / 2010 Instructor: Michael Eckmann.
June 14, ‘99 COLORS IN MATLAB.
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.
1 CS 177 Week 2 Recitation Slides Variables, Files and Functions.
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
CS 106 Introduction to Computer Science I 03 / 22 / 2010 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 09 / 10 / 2007 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 04 / 27 / 2009 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 01 / 24 / 2007 Instructor: Michael Eckmann.
More Digital Representation Discrete information is represented in binary (PandA), and “continuous” information is made discrete.
Python programming Using the JES picture functions and defining new functions.
CS1315: Introduction to Media Computation Introduction to JES.
CompSci 101 Introduction to Computer Science March 8, 2016 Prof. Rodger.
Image Processing Objectives To understand pixel based image processing
A Media Computation Cookbook
CS 177 Week 3 Recitation Slides
CSIS110 - Introduction to Computer Science
CSIS110 - Introduction to Computer Science
Presentation transcript:

CS 102 Computers In Context (Multimedia)‏ 01 / 28 / 2009 Instructor: Michael Eckmann

Michael Eckmann - Skidmore College - CS Spring 2009 Today’s Topics Questions/comments? JES/Jython programming –Defining a function –Call functions –Blocks –Syntax errors Digital images –Pixels –Grayscale / RGB Some JES functions that read and show an image Write a function that swaps the colors in an image

Michael Eckmann - Skidmore College - CS Spring 2009 Some Python def is used to define functions –A function is defined in the following way: def myFunName(parm1, parm2, parm3): statement1 statement2 statement3 statement4 Note: all statements in the body of the function must be indented like above and functions can have 0 or more parameters (the one above has 3).

Michael Eckmann - Skidmore College - CS Spring 2009 Some Python To call a function –give its name and in parentheses any required arguments (parameters) and if it returns something, we typically capture that value in a variable or do something with it. e.g. ord is a python function that takes one argument which is a character and returns the ASCII value of that character –Call it like so --- this will print the returned value: print ord('A')‏ pickAFile is a JES function that takes no arguments and returns the name of the file that the user chooses –Call it like so print pickAFile()‏ or fileName = pickAFile()‏ Let's try pickAFile() now.

Michael Eckmann - Skidmore College - CS Spring 2009 Some Python Blocks –A block is a section of code that has the same indentation –For example, see the slide that I described def on. The four statements are in a block. –There can be subblocks within blocks Example on the board Syntax errors –Syntax errors occur if we try to run a program that has some text that the python interpreter cannot understand or if we type a command that the interpreter cannot understand. For example –Typing pint instead of print –Let's try some now

Michael Eckmann - Skidmore College - CS Spring 2009 Digital images A digital image is simply matrix (2 dimensional array) of numbers. Each element of the matrix is called a pixel and the numbers signify the color of that pixel. For grayscale images (sometimes misnamed as black-and-white images) each pixel is usually 1 byte (so it can have a value from ). For color images, each pixel is usually 3 bytes, one byte for each of the three channels (Red, Green and Blue.) Each of the color channels can have a value of There are many other color formats but RGB is common and that's what we'll use in this course.

Michael Eckmann - Skidmore College - CS Spring 2009 Digital images The Red, Green and Blue colors can mix in 256*256*256 (over 16 million) ways. This does not cover the entire range of colors that humans can see, but seems to be more than “good enough” for most purposes. Let's look at how Red Green and Blue light mix to get a wide range of colors. Note that this is a different from the kind of mixing of color pigments. –Mixing pigments = subtractive color model like CMY –Mixing lights = additive color model like RGB

Michael Eckmann - Skidmore College - CS Spring 2009 Digital images Let's load up some images in Gimp (Gnu Image Manipulation Program) --- a program that has similar functionality to Adobe Photoshop --- and we'll view the pixel values. –For color images, RGB values: ( 0, 0, 0) = black ( 255, 255, 255) = white ( x, x, x) = some level of gray, where all the x's are the same value (200, 10, 4) = a red color etc.

Michael Eckmann - Skidmore College - CS Spring 2009 Some JES functions JES functions are those provided by the JES system and are not available in general in jython or python. pickAFile makePicture show Let's use these and then write a function that swaps the color channels of an image.