1 / 7

ted/talks/kevin_slavin_how_algorithms_shape_our_world

Algorithm. http://www.ted.com/talks/kevin_slavin_how_algorithms_shape_our_world. B/W picture. When red, green, and blue color values are identical Appears to be B/W How to determine the intensity of B/W ? bw = (red value + green value + blue value)/3. Repeat in JES. How to automate it ?.

ballari-taj
Download Presentation

ted/talks/kevin_slavin_how_algorithms_shape_our_world

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Algorithm • http://www.ted.com/talks/kevin_slavin_how_algorithms_shape_our_world

  2. B/W picture • When red, green, and blue color values are identical • Appears to be B/W • How to determine the intensity of B/W ? • bw = (red value + green value + blue value)/3

  3. Repeat in JES

  4. How to automate it ? • Write a function to carry out changes to bw • What does the function bwRow() do ? • How to run (execute) it ?

  5. How to automate it for the entire picture ? def greyScale(pic): wid = pic.getWidth() hgt = pic.getHeight() for row in range(0,hgt): for col in range(0, wid): myPix = pic.getPixel(col, row) bw = (myPix.getRed()+myPix.getGreen()+myPix.getBlue())/3 gray = makeColor(bw,bw,bw) setColor(myPix,gray) return pic

  6. Example

  7. LAB • Write a Python function to create a negative of a picture • How to create a negative pixel ? • Given red, green, blue colors of a pixel, • negColor=makeColor( 255-red, 255-green, 255-blue) • Set the color of the pixel to negColor • Repeat it for the entire picture • Open a new MS Word document, copy/paste a screen shot with the function and the result, and send MS Word to kim@cs.uml.edu.

More Related