Spring 2010 EECS 110: Homework III.

Slides:



Advertisements
Similar presentations
Insert complete company name Creating an Excel Spreadsheet Using Excel 2000.
Advertisements

RAPTOR Syntax and Semantics By Lt Col Schorsch
Computer Science 111 Fundamentals of Programming I More Digital Image Processing.
The Binary Numbering Systems
Code for diagrams Types of Lines: Solid Lines = Light Rays Dashed Lines = Virtual Rays Dotted Lines = Guide lines (not a ray) Colors: Blue = Incident Light.
Effective Digital Imaging using Basic Composition and Adobe Photoshop Paul S. Marley Instructional Technology Specialist Department of Art Wake Forest.
HW 3: Problems 2&3. HW 3 Prob 2:Encipher encipher( S, n ) takes as input a string S and a non-negative integer n between 0 and 25. This function returns.
Data Representation Computer Organization &
Data Representation COE 205
Eleven colors and rasters. Color objects Meta represents colors with color objects You can create a color by saying: [color r g b] r: amount of red (0-255)
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
Tutorial 3: Working with Images. Objectives Session 3.1 – Identify the differences among image file types – Evaluate the purpose of alternative text –
Computers Organization & Assembly Language
Spring  Evolving Lists & Lights On!  Caesar Cipher  Looks Good!
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.
Six Principles of Good Design
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
EECS 110: Lec 8: Lists of Lists Aleksandar Kuzmanovic Northwestern University
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
BACS 287 Programming Logic 1. BACS 287 Programming Basics There are 3 general approaches to writing programs – Unstructured – Structured – Object-oriented.
Code Design Using Functions CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
ManipulatingPictures-Mod6-part61 Manipulating Pictures, Arrays, and Loops: Eliminating color, Inversion, grey scale and adjusting for luminance Barb Ericson.
Comprehending List Comprehensions
CSC508 Convolution Operators. CSC508 Convolution Arguably the most fundamental operation of computer vision It’s a neighborhood operator –Similar to the.
Web Design–Part 2 Links, Graphics, Tables, and Color Explorers Guild May 25, 2000.
EECS 110: Lec 8: Lists of Lists Aleksandar Kuzmanovic Northwestern University
Python Programming in Context Chapter 6. Objectives To understand pixel based image processing To use nested iteration To use and understand tuples To.
1 Arrays of Arrays An array can represent a collection of any type of object - including other arrays! The world is filled with examples Monthly magazine:
Text on a CCR Matrix using the SuperStar Sequence Editor Brian Bruderer.
EECS 110: Lec 9: Review for the Midterm Exam Aleksandar Kuzmanovic Northwestern University
Copyright © Curt Hill Further Picture Manipulation Considering position.
EECS 110: Lec 8: Lists of Lists Aleksandar Kuzmanovic Northwestern University
More Digital Representation Discrete information is represented in binary (PandA), and “continuous” information is made discrete.
Scientific Notation. = 5.4 =3.47 Write the following in standard form A 1.8 X 10⁴ B 3.47 X 10⁷ C 4.3 X 10⁰ D 5.4 X 10⁻⁴ E 5 X 10⁻⁶ F (6 X 10⁴) (7 X 10⁵)
EECS 110: Lec 8: Lists of Lists
AP CSP: Pixelation – B&W/Color Images
Finding The Slope of a Line
Multidimensional Arrays
Image Processing Objectives To understand pixel based image processing
David Meredith Aalborg University
Lec 3: Data Representation
USING MICROBIAL GENETIC ALGORITHM TO SOLVE CARD SPLITTING PROBLEM.
EECS 110: Lec 9: Review for the Midterm Exam
Barb Ericson Georgia Institute of Technology Dec 2009
Whatcha doin'? Aims: To understand the Caesar Cipher.
DIP 9 65 Original 210 Eye Zoomed.
Chapter Lessons Create and format text Flow text into an object
Fundamentals of Programming I Introduction to Digital Image Processing
Classification with Perceptrons Reading:
Chapter 5 Working with Images
CSc 110, Spring 2018 Lecture 9: Parameters, Graphics and Random
Gray Scale picture def pixBW(pixel): # given a pixel, change to BW
Spring 2010 EECS 110: Homework I.
Multidimensional Arrays and Image Manipulation
Fundamentals of Programming I Introduction to Digital Image Processing
BEGINNER PROGRAMMING LESSON
Technique 6: General gray-level transformations
Spring 2015.
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 Arrays
Manipulating Pictures, Arrays, and Loops
Technique 6: General gray-level transformations
Manipulating Pictures, Arrays, and Loops part 6
Digital Image Processing
Magnetic Resonance Imaging
GO! with Microsoft® Excel 2010
Non-numeric Data Representation
Finding The Slope of a Line
Finding The Slope of a Line
Manipulating Pictures, Arrays, and Loops part 6
Presentation transcript:

Spring 2010 EECS 110: Homework III

Homework III Evolving Lists & Lights On! Caesar Cipher Looks Good!

Problem 2: Caesar Cipher Overview encipher(S, n) Rotates the string S by n characters Example: encipher('AbC', 2) returns 'CdE' encipher('xYz', 4) returns 'bCd' decipher(S) Retrieve the original string from an enciphered version (with unknown rotation)

Problem 2: Caesar Cipher encipher – Overview Recursion Rotate character individually Rules: Lower-case → lower-case Upper-case → upper-case Otherwise → unchanged Character checking: 'a' <= c <= 'z' 'A' <= c <= 'Z' Character rotation: using ASCII values

Problem 2: Caesar Cipher encipher – Character Rotation ASCII values Useful functions: ord('a') returns 97 chr(66) returns 'B' Example: rotate 'b' by 22 characters: chr(ord('b') + 22) returns 'x' Note: need to take care of wrapping around A B C … X Y Z 65 66 67 88 89 90 a b c x y z 97 98 99 120 121 122

Problem 2: Caesar Cipher decipher – Strategy Unknown number of rotation → Test 26 cases and pick out the best Techniques: English letter appearance probability (provided!) Scrabble scores (roughly a reverse of the above) Any other heuristics (i.e. rules of thumb) Should work well on large strings

Problem 2: Caesar Cipher decipher – Example Flow Create a list of all possibilities (there are 26) #['Dmc', 'End', 'Foe', ...] For each possibility, calculate the sum of the probability of the letters #[0.0766, 0.1943, 0.1802, ...] Return the one with the largest sum (using recursion? using for loop?)

Problem 3: Looks Good Overview See class web-site for set-up instruction Goals: Write basic image editing tools At least 3, one from each of the following: Group 1: negative, gray scale Group 2: vertical flip, horizontal flip, vertical mirror, horizontal mirror Group 3: scale, blur, random grid

Problem 3: Looks Good Image An image is a 2 dimensional list (i.e. list of lists) of pixels Example: pixels = [[pixel, pixel], [pixel, pixel], [pixel, pixel]] Note: An image is a list of rows A row is a list of pixels len(pixels) returns height len(pixels[0]) returns width

Problem 3: Looks Good Pixel Color A pixel is a tuple of 3 colors red, green, blue Color value is from 0 to 255 Example: (255,0,0) is red (100,100,100) is gray (112, 48, 160) is purple List uses [ ], tuple uses ( ) No difference (for now)

Problem 3: Looks Good Put them together pixels = [[(255,0,0), (0,255,0)], [(0,0,255), (100,100,100)], [ (0,0,0), (112,48,160)]]

Problem 3: Looks Good Example Code: Brighten The beginning from modifyBase import * label = "Brighten" # change this ordinal = 1 Similarity in roles to problem 1: modify(pic) is similar to evolve(L) setNewPixel is similar to setNewElement In general, modifying setNewPixel is enough, but feel free to do anything else.

Problem 3: Looks Good Functions to implement Group 1 (individual pixel): Negative: new color value = 255 – original value Grayscale (values of red, green & blue are equal) Group 2 (change pixel position): Flip/Mirror horizontally/vertically Group 3 (using multiple pixels): Scale Blur: take an average of surrounding pixels Random Grid: Use random.shuffle(L)

Homework III Have fun + Good luck