Test 2 on Wed, 11/9 On image processing

Slides:



Advertisements
Similar presentations
CS1315: Introduction to Media Computation Making sense of functions.
Advertisements

A Media Computation Cookbook Manipulating Images and Sounds for Use in Alice Part 1: Image Manipulations Part 2: Advanced Image Manipulations, e.g., changing.
Python: Modifying Pictures Using Loops. Review JES command area – program area Defining/using functions specifying a sequence of steps for what the function.
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.
CS 102 Computers In Context (Multimedia)‏ 02 / 06 / 2009 Instructor: Michael Eckmann.
CS 102 Computers In Context (Multimedia)‏ 02 / 18 / 2009 Instructor: Michael Eckmann.
1 CS 177 Week 6 Recitation Slides Scaling Drawing on images Vector-based Vs. Bitmap graphical representation.
CS 102 Computers In Context (Multimedia)‏ 02 / 25 / 2009 Instructor: Michael Eckmann.
Computer Science 111 Fundamentals of Programming I Introduction to Digital Image Processing.
Some Utility Functions If you know the name of the file, searching for it with pickAFile() feels tedious You can set and get a media folder (path) for.
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.
Computer Science 101 Introduction to Programming with Pictures.
Image Processing & Perception Sec 9-11 Web Design.
How to use the Java class libraries Brief documentation of how to do this all with Java.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
Download JES Tool JES: Jython Environment for Students
02-RangesInPictures1 Barb Ericson Georgia Institute of Technology Oct 2010 Working with ranges in pictures.
Computer Science 112 Fundamentals of Programming II Graphics Programming.
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.
CS1315: Introduction to Media Computation Picture encoding and manipulation.
TOPIC 11 RETURNING VALUES FROM METHODS PICTURE TRANSFORMATIONS 1 Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
1 CS 177 Week 5 Recitation Slides Mirroring and copying images, Using for Loop, if statement, and range.
CS 101: Introduction to Computing Rotating and Blurring Developed by Mark Guzdial, Georgia Institute of Technology, 2003–2004; modified by Robert H. Sloan,
Chapter 4: Modifying Pixels in a Range (partial slide deck)
Introduction to Computing and Programming in Python: A Multimedia Approach Chapter 4: Modifying Pixels in a Range.
Georgia Institute of Technology Two-Dimensional Arrays and Nested Loops – part 5 Barb Ericson Georgia Institute of Technology August 2005.
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.
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.
Creating a picture in JES Use in the command window of JES (black background at bottom) to set the folder where the picture is to be saved >>> path = setMediaPath()
Python Programming in Context Chapter 6. Objectives To understand pixel based image processing To use nested iteration To use and understand tuples To.
NestedLoops-part21 Nested Loops – part 2 Barb Ericson Georgia Institute of Technology Nov 2009.
CSC 112Introduction to Media Computation 1 Rotating Images.
CS1315: Introduction to Media Computation Transforming pictures by index number.
I MAGE P ROCESSING IN CS1 Brad Miller David Ranum Luther College.
1 Sections 5.1 – 5.2 Digital Image Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
What is a Function Expression?
David Meredith Aalborg University
Python/JES JES IDE (Integrated Development Environment)
Topic 9 Modifying Pixels in a Matrix: Copying, Cropping
Download JES Tool JES: Jython Environment for Students
Image Processing CS177.
Week 2.
Image Processing & Perception
Picture Functions ppp =makePicture(pickAFile())
PHP Image Manipulation
Fundamentals of Programming I Introduction to Digital Image Processing
Download JES Tool JES: Jython Environment for Students
Workshop for Programming And Systems Management Teachers
Working with ranges in pictures
Color Values All colors in computer images are a combination of red, green and blue Each component is encoded as a number means the color is.
Test 2 on Wed, 11/9 On image processing
What do these words mean to you?
Flooding © 2018.
Two-Dimensional Arrays and Nested Loops – part 5
Gray Scale picture def pixBW(pixel): # given a pixel, change to BW
Lecture 26: Lists of Lists
Week 3.
Fundamentals of Programming I Introduction to Digital Image Processing
Two-Dimensional Arrays and Nested Loops – part 3
Two-Dimensional Arrays and Nested Loops – part 6
Two-Dimensional Arrays and Nested Loops – part 6
CS 177 Week 3 Recitation Slides
CSC1401 Viewing a picture as a 2D image - 2
Two-Dimensional Arrays and Nested Loops – part 6
CS1315: Introduction to Media Computation
Non-numeric Data Representation
Presentation transcript:

Test 2 on Wed, 11/9 On image processing Allowed to use JES to test your code, but discouraged Last day to withdraw with W: 11/15

Pixels and Pictures Pixels are picture elements Each pixel has colors from (0,0,0) to (255,255,255) pixel = picture.getPixel(x,y) color = makeColor(r,g,b) pixel.setColor(color) A picture is a matrix of pixels Columns (x coordinate) from 0 to width-1 Rows (y coordinate) from 0 to height-1

Picture Functions ppp =makePicture(pickAFile()) ppp.getWidth(), ppp.getHeight() xxx=ppp.getPixel( , ) xxx.getColor(), .getRed(), .getGreen(), .getBlue() xxx.setColor(), .setRed(), .setGreen(), .setBlue() makeColor(), pickAColor()

Image Processing Draw a line Paint pixels to red Picture negative (Paint pixels to complements) Get r,g,b of a pixel, repaint it with (255-r, 255-g, 255-b) Picture gray scale Get r,g,b of a pixel, bw = int((r+g+b)/3), repaint it with (bw,bw,bw) Sunset, posterize Pixels are organized in a grid

Gray Scale picture def pixBW(pixel): # given a pixel, change to BW get R,G,B values of the pixel compute the average set R,G,B values of the pixel to the average return def picBW(pic): get the width of pic, and name it get the height of pic, and name it for every y coordinate: for every pixel in the row at the given row y: call pixBW(pixxx)

Gray Scale picture def pixBW(pixel): # given a pixel, change to BW r=pixel.getRed() # get R,G,B values of the pixel g = pixel.getGreen() b = pixel.getBlue() avg = int((r+g+b)/3) # compute the average bw= makeColor(avg, avg, avg) pixel.setColor(bw) # set R,G,B values to the average return def picBW(pic): wid = pic.getWidth() # get the width of pic, and name it hgt = pic.getHeight() #get the height of pic, and name it for y in range(hgt): # for every y coordinate: for x in range(wid): # for every pixel in the row pixBW(pic.getPixel(x,y)) # call pixBW(pixxx)

Additional Picture Functions setMediaPath() – fix a path to media files getMediaPath(filename) file = makeEmptyPicture(100,100) – creates a blank picture of size 100x100 writePictureTo(file, getMediaPath()+“\newpic.jpg”) – save file with name “100x100.jpg” canvas=makePicture(getMediaPath(“newpic.jpg”))

Picture Copy copy.py with Two pictures ‘pictA’ to copy to ‘pictB’ (pictB has to larger than pictA) def picCopy(fromPic, toPic): # for every pixel in fromPic, copy its colors to the same pixel location in the toPic def main(): setMediaPath() picA = makePicture(getMediaPath(“ “) # get the width of picA # get the height of picA # create an empty picture, called picB, with the same dimension picCopy(picA, picB) repaint(pictB)

Picture Copy copy.py with Two pictures ‘pictA’ to copy to ‘pictB’ (pictB has to larger than pictA) def picCopy(fromPic, toPic): hgt = fromPic.getHeight() wid = fromPic.getWidth() for y in range(hgt): for x in range(wid): pixF = fromPic.getPixel(x,y) col = pixF.getColor() pixT = toPic.getPixel(x,y) pixT.setColor(col) return def main(): setMediaPath() picA = makePicture(getMediaPath(“ “) hgt = fromPic.getHeight() wid = fromPic.getWidth() # create a picture in same dimension picB = makeEmptyPicture(wid, hgt) picCopy(picA, picB) repaint(pictB)

Copy flower1 to lower left corner sourceX sourceY flower1 targetX = sourceX targetY = sourceY + ? ? : getHeight(canvas) – getHeight(flower1)

Copy flower2 targetX = sourceX + getWidth(flower1) sourceY flower2 flower1 targetX = sourceX + getWidth(flower1) targetY = sourceY + ? ? : getHeight(canvas) – getHeight(flower2)

Lab_1104 Modify picCopy() so that it has four arguments: picCopy(fromPic, toPic, toX, toY) where toX and toY are coordinates in toPic from where pixels in fromPic have to be copied over Create a large empty picture, called ‘canvas’ Copy flower1.jpg to canvas, and flower2.jpg to canvas next to flower1.jpg Email updated copy.py to COMP1000.201@gmail.com

Edge detection Pixel is different from its neighbors => an edge Measure (criterion) of pixel differences ? One possibility – compare B/W value of a pixel with those at the left and below If differences are above threshold, then an edge (black), otherwise (white) For each pixel in picture1: get B/W values of the pixel, its left and below (how?) if differences of (pixel, left) and (pixel, below) > Threshold paint the pixel black otherwise, paint the pixel white