How Did Photography Go Digital? - Gail...

Preview:

Citation preview

COMP 1001: Introduction to Computers for Arts and Social Sciences

How Did Photography Go Digital?

Binary Numbers and Data Representation

COMP 1001: Introduction to Computers for Arts and Social Sciences

Admin Stuff

Assignment 1 Posted (how to submit, etc…)

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

Learning Objectives

• Learn how information is stored on a computer.

COMP 1001: Introduction to Computers for Arts and Social Sciences

Part 1

How photography

works

Pixels

Black and white images

Colour images

Part 2

Binary numbers

Converting binary and

decimal

Using Python to convert numbers

Part 3

Bits and bytes

Numbers and text in

memory

Images in memory

Vector versus raster images

COMP 1001: Introduction to Computers for Arts and Social Sciences

http://www.flickr.com/photos/grange85/12501119/

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

Part 1

How photography

works

Pixels

Black and white images

Colour images

Part 2

Binary numbers

Converting binary and

decimal

Using Python to convert numbers

Part 3

Bits and bytes

Numbers and text in

memory

Images in memory

Vector versus raster images

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

Part 1

How photography

works

Pixels

Black and white images

Colour images

Part 2

Binary numbers

Converting binary and

decimal

Using Python to convert numbers

Part 3

Bits and bytes

Numbers and text in

memory

Images in memory

Vector versus raster images

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

Which of the following is not an accurate fact about one-number-per-

pixel encoding?

It is always less efficient than run-length encoding. Losing a number from a row could greatly affect the picture. Getting one number wrong will not greatly affect the picture.

COMP 1001: Introduction to Computers for Arts and Social Sciences

Which type of image would be most suitable to send over a slow,

unreliable cell network?

One-number-per-pixel Simple run-length encoding

Both are equally fine Neither are appropriate

COMP 1001: Introduction to Computers for Arts and Social Sciences

Part 1

How photography

works

Pixels

Black and white images

Colour images

Part 2

Binary numbers

Converting binary and

decimal

Using Python to convert numbers

Part 3

Bits and bytes

Numbers and text in

memory

Images in memory

Vector versus raster images

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

Part 1

How photography

works

Pixels

Black and white images

Colour images

Part 2

Binary numbers

Converting binary and

decimal

Using Python to convert numbers

Part 3

Bits and bytes

Numbers and text in

memory

Images in memory

Vector versus raster images

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

Find the bags we need to break for the following numbers of stones:

19 3

29 15 8

31

COMP 1001: Introduction to Computers for Arts and Social Sciences

Is it always possible to get the exact number of stones we want from the

bags?

Yes No

It depends

COMP 1001: Introduction to Computers for Arts and Social Sciences

Is there more than one way to choose the bags to break in order to get the

exact number of stones we want?

Yes No

It depends

COMP 1001: Introduction to Computers for Arts and Social Sciences

Part 1

How photography

works

Pixels

Black and white images

Colour images

Part 2

Binary numbers

Converting binary and

decimal

Using Python to convert numbers

Part 3

Bits and bytes

Numbers and text in

memory

Images in memory

Vector versus raster images

COMP 1001: Introduction to Computers for Arts and Social Sciences

Number of stones Binary

19 10011

3 11

29 11101

8 1000

20 10100

COMP 1001: Introduction to Computers for Arts and Social Sciences

Number of stones Binary

19 10011

3 00011

29 11101

8 01000

20 10100

COMP 1001: Introduction to Computers for Arts and Social Sciences

Binary

Decimal

COMP 1001: Introduction to Computers for Arts and Social Sciences

Binary

Decimal

Digits 0-1. Each column is double its neighbour.

Digits 0-9. Each column is ten times its neighbour.

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

What is 01011011 in decimal?

COMP 1001: Introduction to Computers for Arts and Social Sciences

What is 10101010 in decimal?

COMP 1001: Introduction to Computers for Arts and Social Sciences

Figure out this joke:

There are 10 types of people in this world: those who know binary, and those who

don’t.

COMP 1001: Introduction to Computers for Arts and Social Sciences

How can you count to 31 on one hand?

COMP 1001: Introduction to Computers for Arts and Social Sciences

Part 1

How photography

works

Pixels

Black and white images

Colour images

Part 2

Binary numbers

Converting binary and

decimal

Using Python to convert numbers

Part 3

Bits and bytes

Numbers and text in

memory

Images in memory

Vector versus raster images

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

Type the following into the shell, pressing enter after each one:

0b11

0b101

0b10000

0b11111

COMP 1001: Introduction to Computers for Arts and Social Sciences

Type the following into the shell, pressing enter after each one:

0b123

0bhello

COMP 1001: Introduction to Computers for Arts and Social Sciences

Type the following into the shell, pressing enter after each one:

bin(1234)

bin(0b111)

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

Part 1

How photography

works

Pixels

Black and white images

Colour images

Part 2

Binary numbers

Converting binary and

decimal

Using Python to convert numbers

Part 3

Bits and bytes

Numbers and text in

memory

Images in memory

Vector versus raster images

COMP 1001: Introduction to Computers for Arts and Social Sciences

Binary digit

Bit (A single 1 or 0)

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

What is the largest number (in decimal) that you can store in a single

byte?

127 128 255 256

11111111 99999999

COMP 1001: Introduction to Computers for Arts and Social Sciences

What about larger numbers?

COMP 1001: Introduction to Computers for Arts and Social Sciences

COMP 1001: Introduction to Computers for Arts and Social Sciences

183

109

COMP 1001: Introduction to Computers for Arts and Social Sciences

0b1011011101101101 = 46,957

COMP 1001: Introduction to Computers for Arts and Social Sciences

Data Types

Name Type

int plain integer – no decimal point

float floating point number – has a decimal point

complex real + imaginary parts

COMP 1001: Introduction to Computers for Arts and Social Sciences

Storing Text in Memory

0b01000001 (65) A 0b01100001 (97) a

0b01000010 (66) B 0b01100010 (98) b

0b01000011 (67) C 0b01100011 (99) c

Like a code: binary to character

COMP 1001: Introduction to Computers for Arts and Social Sciences

Storing Grayscale Images in Bytes

0%

50%

100%

0b00000000

0b00110010

0b01100100

COMP 1001: Introduction to Computers for Arts and Social Sciences

Storing Grayscale Images in Bytes

0%

50%

100%

0b00000000

0b00110010

0b01100100

We can store a bigger number than 100 in 8 bits! We are wasting space.

COMP 1001: Introduction to Computers for Arts and Social Sciences

Storing Grayscale Images in Bytes

0% = 0

50% = 127

100% = 255

0b00000000

0b01111111

0b11111111

COMP 1001: Introduction to Computers for Arts and Social Sciences

8-bit Color

R R R G G G B B

one byte

COMP 1001: Introduction to Computers for Arts and Social Sciences

8-bit Color

R R R G G G B B

one byte

Although this byte could be interpreted as a single number, we can also set up a standard that says the first three bits will be one number

(for red), the second three bits will be another number (for green), and finally the last two bits will be a third number (for blue).

COMP 1001: Introduction to Computers for Arts and Social Sciences

8-bit Color

R R R G G G B B

8 * 8 * 4 = 256 colors

Red can be between 0 and 7 (8 choices), green is the same, and blue can be between 0 and 3 (4 choices). To get all the combinations of

these colors we multiply 8*8*4 and get 256. Thus, 8-bit color allows for 256 colors.

COMP 1001: Introduction to Computers for Arts and Social Sciences

8-bit Color

http://www.deviantart.com/morelikethis/211513504

COMP 1001: Introduction to Computers for Arts and Social Sciences

24-bit Color

R R R R R R R R

G G G G G G G G

B B B B B B B B

256*256*256 = 16,777,216 colors

COMP 1001: Introduction to Computers for Arts and Social Sciences

Pixel/Raster/Bitmap Graphics

COMP 1001: Introduction to Computers for Arts and Social Sciences

Vector Graphics

COMP 1001: Introduction to Computers for Arts and Social Sciences

The Difference

Two versions of the same image. One is a raster image, the other vector.

COMP 1001: Introduction to Computers for Arts and Social Sciences

Intro to 3D Graphics

COMP 1001: Introduction to Computers for Arts and Social Sciences

What type of graphics do 3D games and animations use?

Vector Raster Both

Neither

COMP 1001: Introduction to Computers for Arts and Social Sciences

Mathematical 3D Objects

COMP 1001: Introduction to Computers for Arts and Social Sciences

Translation

COMP 1001: Introduction to Computers for Arts and Social Sciences

Rotation

COMP 1001: Introduction to Computers for Arts and Social Sciences

Scaling

COMP 1001: Introduction to Computers for Arts and Social Sciences

Issues Encountered in 3D

How much can the camera see?

http://www.chadvernon.com/blog/wp-content/uploads/2007/07/frustum.jpg

COMP 1001: Introduction to Computers for Arts and Social Sciences

Issues Encountered in 3D

Should objects further away look smaller?

COMP 1001: Introduction to Computers for Arts and Social Sciences

Issues Encountered in 3D

Should objects further away look smaller?

http://www.codeguru.com/dbfiles/get_image.php?id=10123&lbl=3DPROJ04_GIF&ds=20061023

NO

COMP 1001: Introduction to Computers for Arts and Social Sciences

A Cool, Fairly Recent Example

3-Sweep: Extracting Editable Objects from a Single Photo

http://www.youtube.com/watch?v=Oie1ZXWceqM

COMP 1001: Introduction to Computers for Arts and Social Sciences

Part 1

How photography

works

Pixels

Black and white images

Colour images

Part 2

Binary numbers

Converting binary and

decimal

Using Python to convert numbers

Part 3

Bits and bytes

Numbers and text in

memory

Images in memory

Vector versus raster images

Recommended