CS1315: Introduction to Media Computation - PowerPoint PPT Presentation

About This Presentation
Title:

CS1315: Introduction to Media Computation

Description:

CS1315: Introduction to Media Computation. Variations on a grayscale theme ... What we need is a value representing the darkness of the color, the luminance ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 9
Provided by: MarkGu
Category:

less

Transcript and Presenter's Notes

Title: CS1315: Introduction to Media Computation


1
CS1315Introduction to Media Computation
  • Variations on a grayscale theme

2
Converting to grayscale
  • We know that if redgreenblue, we get grey
  • But what value do we set all three to?
  • What we need is a value representing the darkness
    of the color, the luminance
  • There are lots of ways of getting it, but one way
    that works reasonably well is dirt simplesimply
    take the average

3
Converting to grayscale
def grayScale(picture) for p in
getPixels(picture) intensity
(getRed(p)getGreen(p)getBlue(p))/3
setColor(p,makeColor(intensity,intensity,intensity
))
4
But thats not really the best grayscale
  • In reality, we dont perceive red, green, and
    blue as equal in their amount of luminance How
    bright (or non-bright) something is.
  • We tend to see blue as darker and red as
    brighter
  • Even if, physically, the same amount of light is
    coming off of each
  • Photoshops grayscale is very nice Very similar
    to the way that our eye sees it
  • BW TVs are also pretty good

5
Building a better greyscale
  • Well weight red, green, and blue based on how
    light we perceive them to be, based on laboratory
    experiments.

def grayScaleNew(picture) for px in
getPixels(picture) newRed getRed(px)
0.299 newGreen getGreen(px) 0.587
newBlue getBlue(px) 0.114 luminance
newRednewGreennewBlue setColor(px,makeColor(
luminance,luminance,luminance))
6
Comparing the two grayscalesAverage on left,
weighted on right
7
Lets use a black cat to compare
8
Average on left, weighted on right
Write a Comment
User Comments (0)
About PowerShow.com