Programming for Art: Images

Slides:



Advertisements
Similar presentations
Playing with pixels Programming For Artists Learning objectives:
Advertisements

Image Processing … computing with and about data, … where "data" includes the values and relative locations of the colors that make up an image.
A Quick Introduction to Processing
Program Memory MIPS memory operations Getting Variable Addresses Advanced structures.
Images. PImage class PImage is a class for loading and displaying an image in Processing. Declare a PImage type: PImage img; Make a new instance by loading.
IAT 334 Lab 2 Computer Graphics: Rocket, PImage. June 4, 2010IAT 3342 Outline  Programming concepts –Programming Computer Graphics –Transformations –Methods.
Processing Processing is a simple programming environment that was created to make it easier to develop visually oriented applications with an emphasis.
ICT for IGCSE – Syllabus Cambridge IGCSE ® Information and Communication Technology0417 Other web pages In own website New window Same page.
Guide to Programming with Python
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
G RAPHICS P ROGRAMMING Lecture 3 - Simple Animation - Simple 3D Drawing.
1 Mastering the Internet and HTML Images and Image Tags.
1 Web Developer Foundations: Using XHTML Chapter 4 Key Concepts.
Introduction to Processing CS 4390/5390 Fall 2014 Shirley Moore, Instructor September 3,
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 11 Fall 2010.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What about the constructor---how.
Processing can load images, display them on the screen, and change their size, position, opacity, and tint. You can load gif, png and jpg images in processing.
CIS 3.5 Lecture 2.2 More programming with "Processing"
Adding Images. XHTML Element ElementAttributeAttribute Value Closing tag AttributeAttribute Value The src attribute supplies the name and location of.
Images. Digital Images Rectangular arrays of pixel data Pixel - picture element, smallest addressable part of the frame buffer. Color depth - the depth.
Lesson 3: Arrays and Loops. Arrays Arrays are like collections of variables Picture mailboxes all lined up in a row, or storage holes in a shelf – You.
1 ENGI 2420 Structured Programming (Lab Tutorial 8) Memorial University of Newfoundland.
Computer Science I Classes and objects Classwork/Homework: Examine and modify my examples. Make your own.
Computer Science I Arrays. Parallel structures. Classwork/Homework: Build your own bouncing things.
Computer Science I Recap: variables & functions. Images. Pseudo-random processing.
Programming for Art: Arrays ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 01 Fall 2010.
Processing TYWu. Where can I download? 2.0b9 Windows 32-bit.
Programming for Art: Arrays – 2D ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 16 Fall 2010.
IAT 265 Images in Processing PImage. Jun 27, 2014IAT 2652 Outline  Programming concepts –Classes –PImage –PFont.
Computer Science I Animations. Bouncing ball. The if statement. Classwork/homework: bouncing something. Compress and upload work to Moodle.
IAT 800 Lecture 8 PImage and PFont. Oct 13, Fall 2009IAT 8002 Outline  Programming concepts –PImage –PFont.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 22 Game Graphics.
C Programming Lecture 15 Two Dimensional Arrays. Two-Dimensional Arrays b The C language allows arrays of any type, including arrays of arrays. With two.
Intro To MATLAB CS Fall 2013 Zach Welch. Overview ●Basics ●MATLAB data structures ●Operations ●Useful functions ●Image Processing and other useful.
Representation of image data
Sprites (Images) and Sounds
David Meredith Aalborg University
IAT 265 PImage and PFont.
Arrays (in Small Basic)
Vector & Raster Graphics in Processing
Animation & Games Module
Microprocessor and Assembly Language
Array Data Structure and Processing Arrays
Adding Images.
CS320n –Visual Programming
Based on lecture notes from Dr. Deepak Kumar of Brynmawr
Programming for Art: Algorithms
Chapter 15, Images …a few points
Multidimensional Arrays
Based on lecture notes from Dr. Deepak Kumar of Brynmawr
Graphics (Characteristics 1)
For Net Art Lecture 2 J Parker
Programming for Artists
Lecture 26: Lists of Lists
More programming with "Processing"
Computer Graphics Buffers
Multidimensional Arrays
Exploring the Internet
Lecture 7: Introduction to Processing
Chapter 15, Images …a few points
Circles! You are going to create an “image” with circle(s)
HTML Images CS 1150 Fall 2016.
Adding Images.
5.5 Adding Photo Gallery Module
Adding Images.
CSC1401 Viewing a picture as a 2D image - 2
Chapter 15, Images …a few points
Adding Images.
Adding Images.
Presentation transcript:

Programming for Art: Images Dr. J. R. Parker Art/Digital Media Lab Lec 17 Fall 2010

Images Images are 2D arrays of pixels. Conceptually, this is clear, and so it should also be clear how to get a pixel value and set one. Images reside in files, GIF or JPEG or PNG etc etc, and so key issues with images in Processing involve reading the image and displaying it.

Images Images are added after other types in the language; they are a complex type, not a simple one, and is based on other types. An image variable is of type PImage (processing image)

Images PImage myImage; void setup () { size (300, 300); myImage = loadImage (“myimage.jpg”); } void draw() background (0); image (myImage, 0, 0);

Images The image file must be in the same directory as the source file, or you will need a path name in the quotes.

Images Load it at a different place each frame … void draw() { background (0); image (myImage, random(30), random(30)); }

Images Load a ball and bounce it PImage myImage; int x=0, y=100; int dx=1, dy=1; void setup () { size (300, 300); myImage = loadImage ("ball.gif"); } Images void draw() { background (0); x += dx; y += dy; image (myImage, x, y); if (x > width-32) dx = -1; else if (x <= 0) dx = 1; if (y > height-32) dy = -1; else if (y<=0) dy = 1; }

Multiple Images PImage myImage, backImage; int x=0, y=100; int dx=1, dy=1; void setup () { size (300, 300); backImage = loadImage ("back.jpg"); myImage = loadImage ("ball.gif"); } void draw() { background (0); x += dx; y += dy; image (backImage, 0, 0); image (myImage, x, y); if (x > width-32) dx = -1; else if (x <= 0) dx = 1; if (y > height-32) dy = -1; else if (y<=0) dy = 1; }

Multiple Images

The Display Window The display window is an Image!

Arrays of arrays This is a 2D array. How is it done? Memory, after all, is one dimensional. We do it by mapping 2D indices onto 1D ones. Column 0 1 2 3 4 5 6 7 Row 0 Row 1 Row 2 A 12

Arrays of arrays Advanced material: Array element A[i][j] is accessed as A + (i*Nrows)+j Column 0 1 2 3 4 5 6 7 Row 0 Row 1 Row 2 A 12

Advanced Material A + (i*Nrows)+j Row 0 Row 1 Row 2 0 1 2 3 4 5 6 7 A 0 1 2 3 4 5 6 7 A + (i*Nrows)+j Row 0 Row 1 Row 2 A A Col 0 Col 1 Col 2 12 A[1][2] = A+(1*Nrows)+2 = A+3+2 = A+5 12

What Use are 2D Arrays? An obvious item is that they can represent the screen. Each element could be a pixel