1 Sections 5.1 – 5.2 Digital Image Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.

Slides:



Advertisements
Similar presentations
LAB SESSION 7 Graphical user interface Applet fundamentals Methods in applets Execution of an applet Graphics class.
Advertisements

Chapter 2: Using Objects Part 1. To learn about variables To understand the concepts of classes and objects To be able to call methods To learn about.
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.
Computer Science 111 Fundamentals of Programming I More Digital Image Processing.
Chapter 3 Syntax, Errors, and Debugging
Chapter 10 Introduction to Arrays
Faculty of Sciences and Social Sciences HOPE Structured Problem Solving Object Oriented Concepts 2 Stewart Blakeway FML 213
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Topics  Applets  Classes used for graphics Graphics Point Dimension.
1 Applets Chapter 1 To understand:  why applets are used to extend the capabilities of Web pages  how an applet is executed and know about the restrictions.
COMP 14: Files and Graphics for Applets June 19, 2000 Nick Vallidis.
James Tam Programming: Part II In this section of notes you will learn about more advanced programming concepts such as looping, functions.
Fundamentals of Python: From First Programs Through Data Structures
First Bytes - LabVIEW. Today’s Session Introduction to LabVIEW Colors and computers Lab to create a color picker Lab to manipulate an image Visual ProgrammingImage.
Manipulating 2D arrays in Java
Computer Science 111 Fundamentals of Programming I Introduction to Digital Image Processing.
Java Review Structure of a graphics program. Computer Graphics and User Interfaces Java is Object-Oriented A program uses objects to model the solution.
CS 106 Introduction to Computer Science I 03 / 17 / 2008 Instructor: Michael Eckmann.
Graphics and Multimedia. Introduction The language contains many sophisticated drawing capabilities as part of namespace System.Drawing and the other.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Image Processing & Perception Sec 9-11 Web Design.
Chapter 5 Using Classes and Objects in Media Computing
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.
Week 3 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Chapter 15 Graphics and Java 2D™ Java How to Program, 8/e (C) 2010 Pearson Education, Inc. All rights reserved.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
Computer Science 111 Fundamentals of Programming I Introduction to Graphics.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Graphics Concepts CS 2302, Fall /3/20142 Drawing Paths.
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.
Graphics Copyright © 2015 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved. Java Methods Object-Oriented Programming and Data.
CSC1401. Learning Goals Understand at a conceptual level What is media computation? How does color vision work? How can you make colors with red, green,
Computer Science 111 Fundamentals of Programming I Introduction to Digital Image Processing.
Day 8: Fruit Loops: Color. Loop Review What does the following loop print? for (int i= 0; i
(C) 2010 Pearson Education, Inc. All rights reserved.  Class Graphics (from package java.awt) provides various methods for drawing text and shapes onto.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Graphics and Java2D Chapter Java Coordinate System Origin is in _____________ corner –Behind title bar of window X values increase to the ________.
Creating a Java Application and Applet
1 Introduction to Graphics b The last one or two sections of each chapter of the textbook focus on graphical issues b Most computer programs have graphical.
CS 106 Introduction to Computer Science I 03 / 22 / 2010 Instructor: Michael Eckmann.
CompSci 4 Java 4 Apr 14, 2009 Prof. Susan Rodger.
CPCS 391 Computer Graphics Lab One. Computer Graphics Using Java What is Computer Graphics: Computer graphics are graphics created using computers and,
1 Section 5.4 Digital Sound Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
1 Section 11.4 Java Interfaces – The Implementation Perspective Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
1 Sections 3.1 – 3.2a Basic Syntax and Semantics Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
1 Section 1.3 Binary Number Systems Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Sections 10.1 – 10.4 Introduction to Arrays
Fundamentals of Programming I Introduction to Graphics
Sections Inheritance and Abstract Classes
Pixels, Colors and Shapes
Fundamentals of Java: AP Computer Science Essentials, 4th Edition
Chapter 3 Syntax, Errors, and Debugging
Image Processing & Perception
Fundamentals of Java: AP Computer Science Essentials, 4th Edition
Chapter 2 First Java Programs
Fundamentals of Programming I Introduction to Digital Image Processing
Graphics and Multimedia
Fundamentals of Programming I Introduction to Graphics
Section 3.2c Strings and Method Signatures
Basic Graphics Drawing Shapes 1.
4.14 GUI and Graphics Case Study: Creating Simple Drawings (Cont.)
Building Java Programs
Graphics -- Introduction
Geb Thomas Adapted from the OpenGL Programming Guide
CSc 110, Spring 2018 Lecture 9: Parameters, Graphics and Random
Implementing Non-Static Features
Fundamentals of Programming I Introduction to Digital Image Processing
Introduction to Computer Science and Object-Oriented Programming
Presentation transcript:

1 Sections 5.1 – 5.2 Digital Image Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne

22 Introduction to Digital Image Processing The Essential Properties of Images: When an image is loaded in a program, the bits map into a rectangle of colored dots (pixels). The coordinates of the grid range from: – (0,0) at the upper-left corner to (Width -1, Height -1) at the lower-right corner. – Width and height are the dimensions in pixels. – X-coordinates increase positively to the right, y- coordinates increase positively to the bottom. 2

33 Introduction to Digital Image Processing (continued) The Essential Properties of Images (cont): An image consists of a width, height, and a set of pixels. Each pixel is accessible by its (x,y) coordinates. A pixel contains integer values that represent color in terms if red, green, and blue (RGB). 3

44 Introduction to Digital Image Processing (continued) The Essential Properties of Images (cont): The pixel at the upper- left corner is at (0,0) and has RGB components 206, 224, and An image with a width of 300 pixels and a height of 225 pixels

55 The images Package The images package defines classes that allow the programmer to: – Load an image from a file. – View the image in a window. – Examine and manipulate an image’s pixels. – Update the window with changes. – Save the image back to a file. 5

66 The images Package (continued) The APImage and Pixel Classes: The two most important classes in the images package. APImage methods include: – Creating an image from a file, or a blank image. – Returning image’s height and width. – Saving the image. 6

77 The images Package (continued) The APImage and Pixel Classes (cont): The Pixel class represents a pixel. – An object of this class contains three integer values to represent RGB. – Methods include: Creating a pixel and specifying RGB values. Returning and resetting the red, green, or blue values. Returning a copy of the pixel. Returning a string representation of the pixel (RGB values). 7

88 The images Package (continued) The Structure of a Simple Image- Processing Program: A program that loads an image (smokey.jpg) from its file and draws it in a window: 8

99 The images Package (continued) Interfaces, Object Instantiation, and Object- Based Programming: Object-based programming uses existing classes, objects, and methods to solve problems. To use an object, the programmer must know its interface (the set of methods it recognizes). 9

10 The images Package (continued) Interfaces, Object Instantiation, and Object- Based Programming (cont): An interface contains the headers of methods and supporting comments about their use. – Including methods’ names, types of parameters they expect, and types of values they return, if any. – No information about how methods work. Application programming interface (API): the set of interfaces in a package or language. 10

11 The images Package (continued) Interfaces, Object Instantiation, and Object- Based Programming (cont): Mutators: methods that do not return a value. – Used to modify the internal contents of an object. – setPixel and setRed Accesors: methods that return values. – Allow users to examine part of an object’s contents. – toString( ) returns a strong representation of the data contained in an object. 11

12 The images Package (continued) Interfaces, Object Instantiation, and Object- Based Programming (cont): Constructors have no return type. – A constructor is called when a new object of a given class is created or instantiated. – Some constructors can receive information in the form of parameters from the caller. 12

13 The images Package (continued) Examining the Attributes of an Image or a Pixel: getWidth and getHeight return the width and height of an image. A simple way to print the string representation of the image: 13

14 The images Package (continued) Modifying the Attributes of an Image or a Pixel: You can use the setPixel method to replace an RGB value at a given position in an image. 14

15 The images Package (continued) Using an Enhanced for Loop to Visit Pixels: An enhanced for loop or for-each loop: – Assumes you want to visit each element in the data structure for some purpose. – On each pass, the loop variable picks up the next available element in the data structure. 15

16