Creative Commons Attribution Non-Commercial Share Alike License

Slides:



Advertisements
Similar presentations
Two-Dimensional Arrays Chapter What is a two-dimensional array? A two-dimensional array has “rows” and “columns,” and can be thought of as a series.
Advertisements

Lecture 10.2 Different Types of Loops, including for and do.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Peer Instruction for the First Time: Experiences of a First Time User in Computer Science Beth Simon Computer Science and Engineering University of California,
2D Arrays in Java. Interfaces  Separating What from How  Phones: Dial  Cars Gas, Break, Steer.
Introduction to Computers and Programming Lecture 10: For Loops Professor: Evan Korth New York University.
Workshop on Peer Instruction: Making Good Clicker Questions Beth Simon Computer Science and Engineering University of California, San Diego Credits: Sara.
Original image: 512 pixels by 512 pixels. Probe is the size of 1 pixel. Picture is sampled at every pixel ( samples taken)
Georgia Institute of Technology Two-Dimensional Arrays and Nested Loops – part 6 Barb Ericson Georgia Institute of Technology August 2005.
TOPIC 9 MODIFYING PIXELS IN A MATRIX: COPYING, CROPPING 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
CSE 8A Lecture 8 Reading for next class: None Prepare for In-term exam 2 PSA4: Collage and Picture Flip, DON’T WAIT (it’s longer than the previous PSAs)
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
How to use the Java class libraries Brief documentation of how to do this all with Java.
TOPIC 7 MODIFYING PIXELS IN A MATRIX NESTED FOR LOOPS 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by.
NestedLoops-part11 Nested Loops – part 1 Barb Ericson Georgia Institute of Technology Nov 2009.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
CSC1401 Viewing a picture as a 2D image - 1. Review from the last week We used a getPixels() to get all of the pixels of a picture But this has been somewhat.
CSE8A Lecture3 TODO: –Finish PSA1 individually (no partner!) and turn it in with the bundlePSA1 command GET AN INTERVIEW for PSA1 from a tutor See tutor.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
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.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
CSE 8A Lecture 8 Reading for next class: PSA4: Collage and Picture Flip, DON’T WAIT (it’s longer than the previous PSAs)
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
NestedLoops-part41 Nested Loops – part 4 Barb Ericson Georgia Institute of Technology Nov 2009.
NestedLoops-Mody7-part51 Two-Dimensional Arrays and Nested Loops – part 5 Rotations Barb Ericson Georgia Institute of Technology May 2007.
Day 8: Fruit Loops: Color. Loop Review What does the following loop print? for (int i= 0; i
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
February ,  2/16: Exam 1 Makeup Papers Available  2/20: Exam 2 Review Sheet Available in Lecture  2/27: Lab 2 due by 11:59:59pm  3/2:
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Risk Management in the Built Environment Management of Risk in Construction By Professor Simon Burtonshaw-Gunn – licensed under the Creative Commons Attribution.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
CSE8A Lecture 5 TODO: –FINISH PSA2 WITH YOUR PARTNER! Read next class: Section 5.1. PLAY WITH CODE! –Get stuck, then figure out how to get unstuck – it’s.
04-ManipulatingPictures-part21 Manipulating Pictures, Arrays, and Loops part 2 Barb Ericson Georgia Institute of Technology June 2008.
Creative Commons Attribution Non-Commercial Share Alike License sa/3.0/
Georgia Institute of Technology Two-Dimensional Arrays and Nested Loops – part 2 Barb Ericson Georgia Institute of Technology August 2005.
Barbara Ericson Georgia Tech Sept 2005
I/O Streams File I/O 2-D array review
Creative Commons Attribution Non-Commercial Share Alike License
Two Dimensional Arrays
Licensing information
CS150 Introduction to Computer Science 1
Workshop for Programming And Systems Management Teachers
reading: Art & Science of Java, Ch. 9
Manipulating Pictures, Arrays, and Loops part 2
BEGINNER EV3 PROGRAMMING Lesson
Two-Dimensional Arrays and Nested Loops – part 2
CSE 8A Lecture 6 Reading for next class:
Gray Scale picture def pixBW(pixel): # given a pixel, change to BW
BEGINNER PROGRAMMING LESSON
Two-Dimensional Arrays and Nested Loops – part 6
Creative Commons Attribution Non-Commercial Share Alike License
Python Practice !!!.
Manipulating Pictures, Arrays, and Loops
Two-Dimensional Arrays and Nested Loops – part 6
Creative Commons Attribution Non-Commercial Share Alike License
INC 161 , CPE 100 Computer Programming
CSC1401 Viewing a picture as a 2D image - 2
Two-Dimensional Arrays and Nested Loops – part 6
Nested Loops Circles inside Circles
Nested Loops Circles inside Circles
Lecture 29: Lists of Lists
BEGINNER EV3 PROGRAMMING Lesson
Exchange.
Presentation transcript:

Creative Commons Attribution Non-Commercial Share Alike License Original Developer: Beth Simon, 2009 bsimon@cs.ucsd.edu

CSE8A Lecture 10 Read next class: read pg 142-152 PSA3 HINT: Collage You should then create a picture that is the same height as the one you chose, but three times as wide. Picture foo = new Picture (100, 300); Turtle jose = new Turtle (25, 50, w);

By the end of today’s class you should be able to… LG22: Read and code nested loops to perform mirroring (and related) transformations using nested loops.

Nested Loops: How do they work? What order are pixels changed? DON’T REVEAL, VOTING OR DISCUSS ISOMORPHIC QUESTION NEXT Nested Loops: How do they work? What order are pixels changed? A method in Picture.java… Pixel p; for (int foo = 0; foo < getWidth(); foo++) { for (int bar 0; bar < getHeight(); bar++) p = getPixel(foo, bar); p.setColor(Color.BLACK); }

Nested Loops: How do they work? What order are pixels changed? A method in Picture.java… Pixel p; for (int bar = 0; bar < getHeight(); bar++) { for (int foo = 0; foo < getWidth(); foo++) p = getPixel(foo, bar); p.setColor(Color.BLACK); }

What do these methods do? What are their return values? getPixel(int x, int y) getHeight() getWidth()

Why does this have an error? A method in Picture.java… Pixel p; for (int bar = 0; bar < getWidth(); bar++) { for (int foo = 0; foo < getHeight(); foo++) p = getPixel(foo, bar); p.setColor(Color.BLACK); } It doesn’t, this loops across rows, going down It doesn’t, this loops down columns, going right It tries to index a pixel off the end of a row (foo value too big) It tries to index a pixel off the end of a column (bar value too big)