NJIT CS 103 - Light, Sound, Magic: Representing Multimedia Digitally

Unformatted text preview:

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyFluency with Information TechnologyThird Editionby Lawrence SnyderChapter 11: Light, Sound, Magic: Representing Multimedia Digitally11-21-2Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyDigitizing Color• RGB Colors: Binary Representation– Giving the intensities for the three constituent colors—red, green, blue—specifies color on monitor• Color intensity is represented as a quantity (0 through 255)• Binary Numbers Compared with Decimal Numbers– Number of digits is the base of numbering system– Binary is two digits: 0 and 1– Decimal is 10 digits: 0 through 9– Hexadecimal is 16 digits: 0 through 9, A through F11-31-3Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyPlace Value in a Decimal Number• To find the quantity expressed by decimal number, the digit in a place is multiplied by the place value, and the results are added11-41-4Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyPlace Value in a Binary Number• Works the same way except that the place values are successive powers of 211-51-5Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyPlace Value in a Binary Number• Given binary representation, we can find decimal equivalent value by multiplying the digit times the place value and adding the results11-61-6Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyConverting a Binary Number to Decimal• Add the decimal values for the places in the binary number with 1's11-71-7Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyBlack and White Colors• A byte is allocated to each RGB intensity– The smallest intensity is 0000 0000– The largest is 1111 1111 in binary• This is 255 in decimal• This is FF in hex• Black (#000000) is no color; white (#FFFFFF) has full intensity for each RGB color11-81-8Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyChanging a Decimal Number to a Binary Number• If the number being converted is smaller than the place value below it, copy the number into the next cell to its right; enter 0 as the binary digit.• If the number being converted is equal to or larger than the place value below it, subtract the place value from the number and copy the result into the first cell of the next column; enter a 1 as the binary digit.11-91-9Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyLighten Up: Changing Color by Addition• What color does this represent:1100 1000 1100 1000 1100 1000• Each byte contains the decimal value 200. The color is RGB(200,200,200).– In HTML, write in hexadecimal #C8C8C8– Equal amounts of red, green, and blue, closer to white than black (medium gray)– All colors with equal RGB values are black, white, or gray11-101-10Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyTo Increase Intensity: Add in Binary• To make a lighter color of gray, change the common values to be closer to white (larger numbers)– For example, add 0001 0000 (decimal 16) to each color:1101 1000 1101 1000 1101 1000 RGB(216,216,216)11-111-11Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyLighter Still: Adding with Carry Digits• Binary addition is similar to decimal addition– Work from right to left, adding corresponding digits in each place position– Sometimes we can add the two numbers and the result is expressed as a single digit (1+0=1)– Sometimes the sum cannot be expressed in one digit and we must carry to the next highest place(1+1=10, put down 0 and carry 1)11-121-12Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley11-131-13Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley11-141-14Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley11-151-15Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley11-161-16Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyOverflow• Because computers use fixed-size bit sequences, what happens when there are not enough bits to represent the correct result of a binary addition?• Called overflow exceptions– Computers report them when the computation they're told to perform overflows; programmer has to find way to recover11-171-17Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyComputing On Representations• Changing the Colors of a Moon Photo– Imagine a scanned black and white photo of the moon– In the computer, the pixels of the photo form a long sequence of RGB triples. What values do they have?• They are all black, white, or gray– Suppose you want a colorized version?11-181-18Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyRemoving the Smudge• You have very dark gray values (28,28,28) from a smudge on the scanner's glass• To remove the smudge and transform the pixels into the colors you remember seeing– Anything very close to black (first 2 digits are 00) can be changed to black (00xx xxxx) (0-63)– Algorithm for this is: Any three RGB bytes, each of whose first 2 bits are 00, are replaced with all zeros11-191-19Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyMaking the Moon Orange• To shift color of moon to orange, change the white pixels:– Pick a shade of orange, say (255,213,132)– Change all the white pixels (255,255,255) to this shade– This will not change the gray of the craters• To change Light Gray into Orange Tint:– Red byte: Leave unchanged– Green byte: reduce green slightly (subtract 42)– Blue byte: reduce blue significantly (subtract 123)11-201-20Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyBoosting the Red• You decide the gray parts of the moon need to be more luminous• Boost the red• Shifting the red in the orange pixels to 255 is too red– Split the difference. Add half the difference between the current value and pure red11-211-21Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley11-221-22Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyDigitizing Sound• An object creates sound by vibrating in a medium such as air– Vibrations push the air–


View Full Document
Download Light, Sound, Magic: Representing Multimedia Digitally
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Light, Sound, Magic: Representing Multimedia Digitally and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Light, Sound, Magic: Representing Multimedia Digitally 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?