Creating an old time photo - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Creating an old time photo

Description:

I like the look of old 'black and white' photos. ... Turn every Pixel to either black or white? ... three values are set to 85 (roughly 1/3 from black to white) ... – PowerPoint PPT presentation

Number of Views:71
Avg rating:3.0/5.0
Slides: 11
Provided by: BenSc
Category:
Tags: and | black | creating | old | photo | time | white

less

Transcript and Presenter's Notes

Title: Creating an old time photo


1
Creating an old time photo
  • I like the look of old black and white photos.
    Suppose that I want to turn an existing picture
    into an old time photo.
  • What would I do?
  • Remove the color from a picture?
  • Turn every Pixel to either black or white?
  • But there are more than two colors, there are
    also grays.

2
The concept of grayscale
  • Gray is any color where the red, green, and blue
    values are all the same.
  • Black is gray because all three values are set
    to 0.
  • White is gray because all three values are set
    to 255.
  • Dark-gray might be the color where all three
    values are set to 85 (roughly 1/3 from black to
    white).
  • Light-gray might be the color where all three
    values are set to 170 (roughly 1/3 from white to
    black).
  • How many different grays are there in our system?

3
So how do I decide what gray goes with what color?
  • One solution is to find the average intensity
    of a pixel, and set the r, g, and b values to
    that intensity
  • (red green blue) / 3

4
One version
  • def makeGrayscale(picture)
  • for pixel in getPixels(picture)
  • redPart getRed(pixel)
  • greenPart getGreen(pixel)
  • bluePart getBlue(pixel)
  • val (redPart greenPart bluePart)/3
  • setRed(pixel,val)
  • setGreen(pixel,val)
  • setBlue(pixel,val)

5
The same results with different code
  • def makeGrayscale(picture)
  • for pixel in getPixels(picture)
  • redPart getRed(pixel)
  • greenPart getGreen(pixel)
  • bluePart getBlue(pixel)
  • val (redPart greenPart bluePart)/3
  • setColor(pixel,makeColor(val,val,val))

6
What about different results with different code
  • Introducing PA01
  • Three tasks
  • Create a flexible modifyRed() method
  • Create several versions of makeGrayscale()
  • Create a makeSepiaTone() method
  • One report
  • Submitted by placing on your p drive by next
    Friday

7
What would I need to do

8
to make this?
9
What is different?
  • Why is this problem different from the kinds of
    activities we looked at this week?
  • It only works with some of the pixels.
  • We have to have the ability to look at pixels
    based on position

10
What does this do?
  • def mysteryMethod(picture)
  • for x in range(1,getWidth(picture))
  • for y in range(1,getHeight(picture))
  • pixel getPixel(x,y)
  • redPart getRed(pixel)
  • greenPart getGreen(pixel)
  • bluePart getBlue(pixel)
  • val (redPart greenPart bluePart)/3
  • setColor(pixel,makeColor(val,val,val))
Write a Comment
User Comments (0)
About PowerShow.com