Digital Pictures Represented by pixels –With a red, green, and blue value stored for each pixel (each has a range from 0 to 255) Stored in.jpg (JPEG) files.

Slides:



Advertisements
Similar presentations
Digital Color 24-bit Color Indexed Color Image file compression
Advertisements

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.
ManipulatingPictures-Mod6-part21 Manipulating Pictures, Arrays, and Loops part 2 Barb Ericson Georgia Institute of Technology.
Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops part 1.
© 2004 Pearson Addison-Wesley. All rights reserved2-1 Introduction to Graphics The last few sections of each chapter of the textbook focus on graphics.
©2004 Brooks/Cole Applets Graphics & GUIs. Figures ©2004 Brooks/Cole CS 119: Intro to JavaFall 2005 Graphical Programs Most applications these days are.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Topics  Applets  Classes used for graphics Graphics Point Dimension.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Java Applets What is an Applet? How do you create.
Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops part 1 Barb Ericson Georgia Institute of Technology August 2005.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 5 Java Graphics Applets.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 5 Applets and Graphics.
A Simple Applet. Applets and applications An applet is a Java program that runs on a web page –Applets can be run from: Internet Explorer Netscape Navigator.
A Simple Applet.
Color (1) Turtle class contains a method to change the pen color Note: before using Color class, you should add following line in the top of the source.
Chapter 5 Graphics. Topics Applets Classes used for graphics –Graphics –Point –Dimension –Color.
Java Review Structure of a graphics program. Computer Graphics and User Interfaces Java is Object-Oriented A program uses objects to model the solution.
Drawing pictures with Java. JFrame: the basic Java window The swing package contains classes, objects and methods that can be used to create a consistent.
History of Digital Camera By : Dontanisha Williams P2.
Java Programs u 1 project file –with an extension of.mcp –contains information that CodeWarrior needs to run the program u >= 1 source files –have an extension.
I Power Multimedia Technology Video Data. Video data Video is a sequence of individual pictures or frames, taken one after another. These are played back.
Digital Images The digital representation of visual information.
Color Names All standards-compliant browsers should handle these color names These color names can be used with the CSS properties of color and background-color.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Java Applets What is an Applet? How do you create.
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
How to use the Java class libraries Brief documentation of how to do this all with Java.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Standard Graphics in Java,
METHODS AND SCOPE CSCE More on Methods  This is chapter 6 in Small Java.
Copyright © 2009 Curt Hill The Picture Object Getting and displaying.
ManipulatingPictures-part11 Manipulating Pictures, Arrays, and Loops part 1 Barb Ericson Georgia Institute of Technology Nov 2009.
1 Ethics of Computing MONT 113G, Spring 2012 Session 10 HTML Tables Graphics on the Web.
Jeopardy Heading1Heading2Heading3Heading4 Heading5 Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500 Final Jeopardy.
Two –Dimensional Arrays Mrs. C. Furman Java Programming November 19, 2008.
Applets Applet is java program that can be embedded into HTML pages. Java applets runs on the java enabled web browsers such as mozilla and internet explorer.
Chapter 2: Color and Applets Coming up: Introduction to Graphics.
Image Representation. Digital Cameras Scanned Film & Photographs Digitized TV Signals Computer Graphics Radar & Sonar Medical Imaging Devices (X-Ray,
ManipulatingPictures-Mod6-part11 Manipulating Pictures, Arrays, and Loops part 1 Barb Ericson Georgia Institute of Technology.
Graphics & Applets CSC 1051 – Data Structures and Algorithms I
Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the.
CSC1401 Manipulating Pictures. What we have done to date We have modified pictures by writing on top of them Using Turtles and using Graphics Drawing.
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.
Classes Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
 By Bob “The Bird” Fiske & Anita “The Snail” Cost.
Classes. Preparation Scene so far has been background material and experience –Computing systems and problem solving –Variables –Types –Input and output.
1 A Simple Applet. 2 Applets and applications An applet is a Java program that runs on a web page Applets can be run within any modern browser To run.
GUI Components. The Swing package has numerous GUI components that can be added to a window. The Swing package has numerous GUI components that can be.
Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops Barb Ericson Georgia Institute of Technology August 2005.
Lecture # 6 Graphical User Interface(GUI). Introduction A graphical user interface (GUI) presents a user- friendly mechanism for interacting with an application.
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
CS202 Java Object Oriented Programming GUI Programming – Color and Drawing Methods Chengyu Sun California State University, Los Angeles.
Intro to Graphics from Chapter 2 of Java Software Solutions
Chapter 02 Data and Expressions.
Getting and displaying
Manipulating Pictures, Arrays, and Loops part 1
Sampling, Quantization, Color Models & Indexed Color
Image Processing CS177.
Object Oriented Programming
Digital Pictures Represented by pixels Stored in .jpg (JPEG) files
Week 13 - Monday CS 121.
Workshop for Programming And Systems Management Teachers
Representing Images 2.6 – Data Representation.
Manipulating Pictures, Arrays, and Loops
Manipulating Pictures, Arrays, and Loops part 1
COMS 161 Introduction to Computing
COMS 161 Introduction to Computing
Digital Pictures Represented by pixels Stored in .jpg (JPEG) files
CS 177 Week 3 Recitation Slides
Digital Pictures Represented by pixels Stored in .jpg (JPEG) files
CSC1401 Manipulating Pictures 2
Presentation transcript:

Digital Pictures Represented by pixels –With a red, green, and blue value stored for each pixel (each has a range from 0 to 255) Stored in.jpg (JPEG) files –International standard –With “lossy compression” Lossy means not all data is stored –But what is lost isn’t that important Compression means made smaller What are some other formats for storing pictures?

Pictures have lots of Pixels How can we refer to each pixel? –pixel1, pixel2, pixel3, pixel4, pixel5, … Do we really want to name each one? –There are 640 x 480 = 307,200 pixels How could we deal with all of the pixels in a picture WITHOUT naming each one separately?

What is an Array? Storage for a sequence of items –Of the same type You can access items by using the index The index starts at 0 –The first item is at index 0 –The last item is at index (length – 1) Arrays know their length (have a public length field) –arrayObj.length

Manipulating a Picture To manipulate a picture we need to manipulate the pixels that make up the picture –Change the red, green, or blue values at the pixel The Pixel class is not in the Java API!!! –Created by the same people who made the Turtle class (Barbara Ga. Tech) –Each pixel object has a red, green, and blue value

What Information Can A Picture Object Give Us? Each picture object has an array of pixel objects Read from the JPEG file It knows the picture’s width & height Which methods of SimplePicture do this? How would we call them? It knows how to obtain an array of pixel objects What method of SimplePicture does this? How would we call it?

Pixel Objects Each pixel has a red, green, and blue value –getRed(), getGreen(), getBlue() –setRed(v), setGreen(v), setBlue(v) Each pixel knows the location it was in the picture object –getX(), getY() You can also get and set the color at the pixel –getColor(), setColor(color)

Color Objects There is a class defined in Java that represents color –The Color class in the package java.awt –To use the class you must either import java.awt.Color; Use the full name java.awt.Color You can create a color object by giving the red, green, and blue values for it –Color colorObj = new Color(255,10,125);

Predefined Colors The Color class has defined class constants for many colors –Color.red, Color.green, Color.blue, Color.black, Color.white, Color.yellow, Color.gray, Color.orange, Color.pink, Color.cyan, Color.magenta –Or you can use all uppercase names Color.RED, Color.BLUE, Color.BLACK, …

Getting and Setting Pixel Colors EXAMPLE: Get a pixel’s color as a color object Color color1 = pixelObj.getColor(); int red = color1.getRed(); int green = color1.getGreen(); int blue = color1.getBlue(); EXAMPLE: Set a pixel’s color using a new color object red = 20; green = 30; blue = 100; Color color2 = new Color(red,green,blue); pixelObj.setColor(color2);