Two –Dimensional Arrays Mrs. C. Furman Java Programming November 19, 2008.

Slides:



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

Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.
ECE122 L14: Two Dimensional Arrays March 27, 2007 ECE 122 Engineering Problem Solving with Java Lecture 14 Two Dimensional Arrays.
Graphics File Formats. 2 Graphics Data n Vector data –Lines –Polygons –Curves n Bitmap data –Array of pixels –Numerical values corresponding to gray-
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.
Graphics in the web Digital Media: Communication and Design
Data starts with width and height of image Then an array of pixel values (colors) The number of elements in this array is width times height Colors can.
Trevor McCasland Arch Kelley.  Goal: reduce the size of stored files and data while retaining all necessary perceptual information  Used to create an.
CSC – Java Programming II Lecture 9 January 30, 2002.
1 Ethics of Computing MONT 113G, Spring 2012 Session 11 Graphics on the Web Limits of Computer Science.
COMP Bitmapped and Vector Graphics Pages Using Qwizdom.
Digital Images Chapter 8, Exploring the Digital Domain.
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
Image Processing & Perception Sec 9-11 Web Design.
How A Camera Works Image Sensor Shutter Mirror Lens.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 14 Introduction to Computer Graphics.
Image Representation. Objectives  Bitmaps: resolution, colour depth and simple bitmap file calculations.  Vector graphics: drawing list – objects and.
ManipulatingPictures-part11 Manipulating Pictures, Arrays, and Loops part 1 Barb Ericson Georgia Institute of Technology Nov 2009.
Pictures Looping through pixels.. Lab Review (1) Objects  Instantiated from Class  Turtle myTut = new Turtle(myWorld);  new operator creates an instance.
Two dimensional arrays in Java Computer Science 3 Gerb Objective: Use matrices in Java.
1 Ethics of Computing MONT 113G, Spring 2012 Session 10 HTML Tables Graphics on the Web.
Lecture 15: Intro to Graphics Yoni Fridman 7/25/01 7/25/01.
Computer Images Can store color info about each pixel, but makes file BIG Compression for Web 15.
Image Representation. Digital Cameras Scanned Film & Photographs Digitized TV Signals Computer Graphics Radar & Sonar Medical Imaging Devices (X-Ray,
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.
Two –Dimensional Arrays Mrs. C. Furman September 18, 2008.
Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the.
ManipulatingPictures-Mod6-part61 Manipulating Pictures, Arrays, and Loops: Eliminating color, Inversion, grey scale and adjusting for luminance Barb Ericson.
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.
Why a bitmap (.bmp), not a.jpg? If you cannot save a.bmp, make it an uncompressed.tif. Compression (of this 8-bit 397,000 pixel image): none (397kb memory)medium.
Color Web Design Professor Frank. Color Displays Based on cathode ray tubes (CRTs) or back- lighted flat-screen Monitors transmit light - displays use.
 By Bob “The Bird” Fiske & Anita “The Snail” Cost.
POWERPOINT PLUS 11/17/07 Class Notes. WHAT IS A PIXEL A pixel is a number that represents the intensity of light at a square spot in the picture. Pixels.
What color does this represent? Each of these dots represents a PIXEL … a dot of color on a screen.
Data Representation. What is data? Data is information that has been translated into a form that is more convenient to process As information take different.
Get Longest Run Index (FR) public int getLongestRunIndex(int []values) { int maxRunStart = -1, maxRunLength = 1; int runStart = 0, runLength = 1; for(int.
Image File Formats By Dr. Rajeev Srivastava 1. Image File Formats Header and Image data. A typical image file format contains two fields namely Dr. Rajeev.
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
Scanner Scanner Introduction: Scanner is an input device. It reads the graphical images or line art or text from the source and converts.
Textures – Basic Principles Lecture 29 Fri, Nov 14, 2003.
Red Green Blue (RGB) Colour conversions Y and RGB Link In the images, the lighter the colour intensity (Red, Green, Blue), the more the contribution.
BITMAPPED IMAGES & VECTOR DRAWN GRAPHICS
Graphics and image data representation
Image Processing Objectives To understand pixel based image processing
Two-Dimensional Arrays
Computer Science Higher
Image Processing & Perception
Digital Pictures Represented by pixels Stored in .jpg (JPEG) files
Images Presentation Name Course Name Unit # – Lesson #.# – Lesson Name
CS320n –Visual Programming
Multiplying Matrices.
Representing Images 2.6 – Data Representation.
What do these words mean to you?
- orange white green - cyan - red - blue Example 1 24 bit RGB
CS 106A, Lecture 18 Practice with 1D and 2D Arrays
Matrix Multiplication
Images Presentation Name Course Name Unit # – Lesson #.# – Lesson Name
Colors Computers build colors from Red, Green, and Blue; not Red, Blue, and Yellow. RGB = Red Green Blue Creating Colors Red + Blue = Purple No Red, No.
Multidimensional array
Multidimensional Arrays
Digital Pictures Represented by pixels Stored in .jpg (JPEG) files
What Color is it?.
Multiplying Matrices.
Multimedia System Image
Digital Pictures Represented by pixels Stored in .jpg (JPEG) files
Basic Concepts of Digital Imaging
Multiplying Matrices.
Multiplying Matrices.
- orange white green - cyan - red - blue Example 1 24 bit RGB
Multiplying Matrices.
Presentation transcript:

Two –Dimensional Arrays Mrs. C. Furman Java Programming November 19, 2008

Two Dimensional Arrays  rows and columns, also called a Matrix  we must specify the number of row and columns we will need when we construct the 2DArray. Similar to Arrays. Example: int [][] magicSquare = new int [4][4];

Accessing Elements in a 2D Array  Elements are indexed [row][column] magicSquare [0][0] = 3; magicSquare [1][3] = 5; int myNum = magicSquare [1][3];

Initializer List for 2D int [][]cars = {{10, 7, 12, 10, 4}, {18, 11, 15, 17, 10}, {18, 11, 15, 17, 10}, {12, 10, 9, 5, 12}, {12, 10, 9, 5, 12}, {16, 6, 13, 8, 3}}; {16, 6, 13, 8, 3}}; GM Ford Toyota BMW red brown black white gray

Getting Size .length gives us the number of rows… then when we access a specific row, we do.length to get number of columns.  int[][] list = {{1,2,3, 4}, {1}, {1, 2, 3}};  int numRows = list.length;//3  int firstCol = list[0].length;//4  int secCol = list[1].length;//1  int thirdCol = list[2].length;//3

Looping Through a 2D Array Example 3: Write a nested for loop to output all elements in the 2D array. for (int row = 0; row < list.length; row++) { for (int col = 0; col< list[row].length; col++) { System.out.print (list [row][col] + “ “); } System.out.println (); }

Multiplication Table  Write a loop that will assign a 5 x 5 2D Array to the multiplication tables of The result will look like the below 2D Array

Picture Encoding  Bitmap images: each dot or pixel is represented separately.  Pictures are 2-D arrays of pixels.  We will be dealing with.jpg (jpeg) files  Each pixel in a picture has a color  The dimension of the picture is measured in pixels.

JPEG’s  High quality pictures with smaller storage.  JPEG is a lossy compression format.  Lossy compression: it is compressed, made smaller, but not with 100% of the quality of the original.  Typically what gets thrown out is the stuff that you don’t see or notice anyway, so the quality is still considered high.

Color  RGB color model.  Pixels are encoded with three numbers, 1 st for the amount of red, 2 nd for the amount of green, and 3 rd for the amount of blue  We can make any humanly visible color by combining different amounts of red, green and blue.  Combining all 3 together to get white, remove all 3 to get black.  (0,0,0) – black; (255, 255, 255) - white

Some Color examples  (255, 0, 0) – red  (100, 0, 0) – darker red  (0, 100, 0) – dark green  (0, 0, 100) – dark blue  All 3 the same… we get gray…  (50, 50,50) – dark gray  (150, 150, 150) – lighter gray