CS149: Elements of Computer Science Data representation 0=low, - - PowerPoint PPT Presentation

cs149 elements of computer science data representation
SMART_READER_LITE
LIVE PREVIEW

CS149: Elements of Computer Science Data representation 0=low, - - PowerPoint PPT Presentation

CS149: Elements of Computer Science Data representation 0=low, 1=high 1. Format (b) More intermediate levels = higher (a) Computers use binary system to error rate represent information (c) Rationale is underlying (b) Bit = binary digit, or


slide-1
SLIDE 1

CS149: Elements of Computer Science Data representation

  • 1. Format

(a) Computers use binary system to represent information (b) Bit = binary digit, or {0,1} (c) byte = 8 bits, kilobyte (kb) = 1024 bytes, megabyte (mb) = 10242 bytes, gigabyte = 10243 bytes

  • 2. Why binary?

(a) Corresponds to levels of voltage, 0=low, 1=high (b) More intermediate levels = higher error rate (c) Rationale is underlying electronics: logic gates

  • 3. Two problems:

(a) How to store and manipulate these bits? (b) How to represent information using only 0s and 1s?

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 1

slide-2
SLIDE 2

CS149: Elements of Computer Science Bit storage and manipulations: Boolean logic and gates

  • Boolean logic:
  • 1. Two valued logic

(a) Statements are either TRUE and FALSE (b) True=1 and FALSE=0 (c) Remember: this is formal

  • logic. Truth or falsehood of

statement is determined syntactically, not on empirical grounds!

  • 2. Operations to combine statements:

truth of combined statement depends on truth of separate statements and operation (a) AND: Raven are white AND the sky is blue (b) OR: Raven are white OR the sky is blue (c) XOR: Raven are black XOR the sky is blue (d) NOT: NOT Raven are black

  • Implemented by logic gates:
  • 1. Little machines that take one or

two inputs (TRUE/FALSE, O/1) and perform AND, OR, XOR or NOT operation

  • 2. Actual mechanical

implementation changes (relays, ICs, manual switches)

  • 3. Heart of information processing in

computers

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 2

slide-3
SLIDE 3

CS149: Elements of Computer Science Boolean Logic: AND

Logic: about truth or falsity. Example: Determination of truth value for statement C: Statement C = A AND B Statement A: The weather is dry. Statement B: It is warm. Statement C tell us whether it is true that the weather is good...

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 3

slide-4
SLIDE 4

CS149: Elements of Computer Science Boolean Logic: OR

Example: Determination of truth value for statement C: Statement C = A OR B Statement A: It snows Statement B: It rains Statement C tell us whether it is true that we had any precipitation today.

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 4

slide-5
SLIDE 5

CS149: Elements of Computer Science Boolean Logic: XOR

Example: Assume we have a dam with releases. Closing a release holds more water in the reservoir lake and will cause it to gradually fill. However, if two releases are closed the reservoir lake threatens to overflow. We therefore built a mechanism that opens the dam when the lake overflows. It empties the lake. Determination of truth value for statement C: Statement C = A XOR B Statement A: release 1 is closed Statement B: release 2 is closed Statement C tell us whether it is true that we have filled the reservoir lake.

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 5

slide-6
SLIDE 6

CS149: Elements of Computer Science Boolean Logic: NOT

Statement A: Ken is a liar. Statement C = NOT A Statement C tell us what Ken is not. Wait a minute...What happens when Ken issues statement A...?

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 6

slide-7
SLIDE 7

CS149: Elements of Computer Science Boolean logic and gates

  • Logic gates: electronic components

that respond to input values, e.g. low (0) and high (1), by generating specific

  • utput values
  • 1. Four types of gates correspond to

4 basic operations: AND, OR, XOR, and NOT

  • 2. Correspond to Boolean logic
  • perations
  • 3. Operate on two binary input

values: false-true, yes-no, 0-1

  • 4. Resulting output for given inputs

listed in truth tables for each type

  • Truth tables:

AND Inp Out 1 1 1 1 1 OR In Out 1 1 1 1 1 1 1 XOR In Out 1 1 1 1 1 1 NOT Inp Out 1 1

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 7

slide-8
SLIDE 8

CS149: Elements of Computer Science Representation

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 8

slide-9
SLIDE 9

CS149: Elements of Computer Science Combining gates

  • 1. Circuits:

(a) Can perform very complex functions: in fact ALL dig- ital computer functions are implemented by combina- tions of logic gates! (b) Output of one gate is fed into another’s input (c) Values cascade through system and final

  • utput

values are generated

NOT (A AND B) circuit

C = AB

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 9

slide-10
SLIDE 10

CS149: Elements of Computer Science NOT ((NOT B AND A) OR C) circuit

C = BA+Ca

ablack dots are connectors: they are not gates

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 10

slide-11
SLIDE 11

CS149: Elements of Computer Science How to generate a truth table for a given circuit

  • 1. Values cascade through system starting

from inputs to outputs

  • 2. Your objective is to find output values

for every possible combination of input values

  • 3. Identify the input and output channels
  • 4. Generate blank table:

(a) First columns (left to right) are input channels (b) Last columns are output channels (c) Write down all possible combinations of input values: start at right most columns, use “doubling” technique discussed in class

  • 5. Start at first row

(a) mark input values at appropriate channels (b) Start propagating values through gates, write down gate output values (c) When values finally recombine at

  • utput channel, write down value

in appropriate column

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 11

slide-12
SLIDE 12

CS149: Elements of Computer Science Example: bit equality comparator

C = AB+AB A B C 1 1 1 1 1 1

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 12

slide-13
SLIDE 13

CS149: Elements of Computer Science Example: three inputs

A B C D 1 1 1 1 1 1 1 1 1 1 1 1

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 13

slide-14
SLIDE 14

CS149: Elements of Computer Science Information storage: Flip-Flop Memory Element

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 14

slide-15
SLIDE 15

CS149: Elements of Computer Science

  • 1. Memory: Collection of 0’s and 1’s

saved as status of flipflops. (a) Flipflop collections store large number of bits (b) Each flipflop or collection can be addressed individually for retrieval

  • 2. Exercise:

(a) Generate truth table for flipflop above (b) Determine how value can be reset and changed

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 15

slide-16
SLIDE 16

CS149: Elements of Computer Science Information Representation

  • 1. Information

(a) Text (b) Numbers (c) Images (d) Sounds

  • 2. Challenge: representation as 0’s and 1’s

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 16

slide-17
SLIDE 17

CS149: Elements of Computer Science Binary Message sent Arecibo Radio Telescope

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 17

slide-18
SLIDE 18

CS149: Elements of Computer Science Text Representation

  • 1. ASCII (American Standard Code for Information Exchange) code:

(a) Each characters matches a 1 byte bit sequence

  • i. 1 byte: 8 bits
  • ii. example: 01000101= ’E’

(b) 1 byte ˜ 256 characters

  • i. 4 groups of 32 chars:
  • A. Control characters
  • B. Punctuation, misc., and numeric
  • C. Upper case alphabetic
  • D. Lower case alphabetic
  • ii. Remaining 128 values: miscellaneous

(c) Example: ’Hello.’: 01001000 01100101 01101100 01101100 01101111 00101110

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 18

slide-19
SLIDE 19

CS149: Elements of Computer Science ASCII Table: GROUP 1

00000000 NUL 00000001 SOH 00000010 STX 00000011 ETX 00000100 EOT 00000101 ENQ 00000110 ACK 00000111 BEL 00001000 BS 00001001 HT 00001010 LF 00001011 VT 00001100 FF 00001101 CR 00001110 SO 00001111 SI 00010000 DLE 00010001 DC1 00010010 DC2 00010011 DC3 00010100 DC4 00010101 NAK 00010110 SYN 00010111 ETB 00011000 CAN 00011001 EM 00011010 SUB 00011011 ESC 00011100 FS 00011101 GS 00011110 RS 00011111 US 00100000 SP

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 19

slide-20
SLIDE 20

CS149: Elements of Computer Science ASCII Table: GROUP 2

00100001 ! 00100010 ” 00100011 # 00100100 $ 00100101 % 00100110 & 00100111 ’ 00101000 ( 00101001 ) 00101010 * 00101011 + 00101100 , 00101101 00101110 . 00101111 / 00110000 0 00110001 1 00110010 2 00110011 3 00110100 4 00110101 5 00110110 6 00110111 7 00111000 8 00111001 9 00111010 : 00111011 ; 00111100 ¡ 00111101 = 00111110 ¿ 00111111 ? 01000000 @

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 20

slide-21
SLIDE 21

CS149: Elements of Computer Science ASCII Table: GROUP 3

01000001 A 01000010 B 01000011 C 01000100 D 01000101 E 01000110 F 01000111 G 01001000 H 01001001 I 01001010 J 01001011 K 01001100 L 01001101 M 01001110 N 01001111 O 01010000 P 01010001 Q 01010010 R 01010011 S 01010100 T 01010101 U 01010110 V 01010111 W 01011000 X 01011001 Y 01011010 Z 01011011 [ 01011100 \ 01011101 ] 01011110 ˆ 01011111 01100000 ‘

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 21

slide-22
SLIDE 22

CS149: Elements of Computer Science ASCII Table: GROUP 4

01100001 a 01100010 b 01100011 c 01100100 d 01100101 e 01100110 f 01100111 g 01101000 h 01101001 i 01101010 j 01101011 k 01101100 l 01101101 m 01101110 n 01101111 o 01110000 p 01110001 q 01110010 r 01110011 s 01110100 t 01110101 u 01110110 v 01110111 w 01111000 x 01111001 y 01111010 z 01111011 { 01111100 — 01111101 } 01111110 ˜ 01111111 DEL

http://www.cs.odu.edu/˜jbollen/CS149/ascii bin table.txt

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 22

slide-23
SLIDE 23

CS149: Elements of Computer Science Text Representation, cont.

  • 2. UNICODE:

(a) 16 bit code: 65,536 characters (b) Designed to represent non-Western symbols (c) Common on Internet

  • 3. ISO 32 bit code

(a) 32 bit: 232 characters (b) Should be enough for any alphabet

Demonstration binary editor...

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 23

slide-24
SLIDE 24

CS149: Elements of Computer Science Number Representation

  • 1. Why not use ASCII?

(a) Not related to actual numeric value! (b) Arbitrary code that may change.

  • 2. How can we represent numbers by bit sequences?
  • 3. Example: Base 10: Positional System

(a) Position of numeral correspond to powers of 10 (b) E.g. 174 = 1×102 +7×101 +4×100 (c) Same for binary numbers, except it works on powers of 2

  • 4. Shift to base 2: position correspond to powers of 2

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 24

slide-25
SLIDE 25

CS149: Elements of Computer Science Base 10 and 2 number representation

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 25

slide-26
SLIDE 26

CS149: Elements of Computer Science Base 2 examples

0000 0001 1 0010 2 0011 3 0100 4 0101 5 ··· ··· 101001 41

  • 1. Note how you need a certain number of

bits

  • 2. 4bits: < 16, 8 bits: < 256, 16 bits: <

65535

  • 3. Maximum number that can be stored in

n bits is 2n

  • 4. What happens if you only have 8

bits and you need to represent 345 (base10)?

  • 5. Right: least significant bit, left=most

significant bit

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 26

slide-27
SLIDE 27

CS149: Elements of Computer Science Base 10 to base 2 conversion algorithm

  • 1. Divide by 2
  • 2. Record quotient, remainder = next right to left bit value
  • 3. Stop when quotient = 0

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 27

slide-28
SLIDE 28

CS149: Elements of Computer Science Binary addition

  • 1. Same as addition in base 10
  • 2. However: carry when 1+1 → 0 and carry 1
  • 3. Example:

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 28

slide-29
SLIDE 29

CS149: Elements of Computer Science Binary addition in Boolean Logic

This is a half adder circuit: it does not take into account previous carry

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 29

slide-30
SLIDE 30

CS149: Elements of Computer Science Binary subtraction

  • 1. Same as subtraction in base 10
  • 2. Borrow to right by subtracting from digit to left etc
  • 3. Does not work when result is negative (we do not yet have a way

representing negative numbers!)

  • 4. Example:

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 30

slide-31
SLIDE 31

CS149: Elements of Computer Science ASCII again

Since ASCII code = sequence of 0s and 1s, these can be converted to base 10 numbers

  • 1. A = 01000001, 01000001 = 65 (base10)
  • 2. ASCII math: B = A + 1, C = A + 2
  • 3. So what is ascii code for C?

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 31

slide-32
SLIDE 32

CS149: Elements of Computer Science Dealing with sign and fractions

  • 1. Two’s Complement notation
  • 2. Fractions
  • 3. Floating Point notation
  • 4. These are conventions shaped by necessity and convenience.

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 32

slide-33
SLIDE 33

CS149: Elements of Computer Science Two’s complement

bin b10 2s com 000 001 1 1 010 2 2 011 3 3 100 4

  • 4

101 5

  • 3

110 6

  • 2

111 7

  • 1
  • 1. Based on subtracting positive numbers

from zero: −3 = 0−(+3) (a) Use binary subtraction to subtract any number from zero (b) Take into account computer only sees n bits (you borrow from 1 out- side of “scope”)

  • 2. Most significant bit indicates sign
  • 3. If n = number of bits then negative

numbers correspond to binary value - 2n.

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 33

slide-34
SLIDE 34

CS149: Elements of Computer Science

0000 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8

  • 8

1001 9

  • 7

1010 10

  • 6

1011 11

  • 5

1100 12

  • 4

1101 13

  • 3

1110 14

  • 2

1111 15

  • 1
  • 1. Same for four bits (shown left)
  • 2. Leftmost bit indicates sign
  • 3. If n = number of bits then nega-

tive numbers correspond to bi- nary value - 2n.

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 34

slide-35
SLIDE 35

CS149: Elements of Computer Science Conversion of positive to negative

  • 1. Two methods:

(a) copy up to 1st 1 (right to left) and invert rest

  • i. e.g: 011 = 3
  • ii. copy to 1st 1: ()()(1)
  • iii. complement rest: (1)(0)(1) = -3

(b) Invert and add 1:

  • i. e.g.: 011 = 3
  • ii. 011 → invert → 100
  • iii. 100 + 001 = 101 = -3
  • 2. Second method is based on subtraction from zero technique

(a) For example: 4 bits, number is +4 or 0100 (b) Subtract from 0000, or (1111+1), i.e. (1111+1)-0100 or (1111-0100)+1 (c) Subtract from 1111 is inversion, then add 1...

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 35

slide-36
SLIDE 36

CS149: Elements of Computer Science Some important notes on the pitfalls of Two’s Complement notation.

  • 1. Two’s Complement notation is NOT standard binary notation
  • 2. Negative numbers can not be read as standard binary numbers

(a) Look at leftmost bit: 0=+, 1=- (b) Negative? Convert to positive counterpart (c) Positive? Read as standard binary number

  • 3. Watch number of bits

(a) Range of values is split in half (b) Largest positive number in 3 bit: +3, 4 bit: +7 (c) Add leftmost zero for positive numbers if necessary!

  • 4. http://www.cs.odu.edu/˜jbollen/CS149/notes 2scompl.html!

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 36

slide-37
SLIDE 37

CS149: Elements of Computer Science Addition in Two’s Complement Notation

  • 1. Same as for standard notation
  • 2. Subtraction

(a) This is the true benefit of two’s complement (b) substraction = addition of Two’s Complement negative number (c) Same circuitry for both addition and subtraction

  • 3. Example:

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 37

slide-38
SLIDE 38

CS149: Elements of Computer Science Overflow

  • 1. Range of positive and negative values is restricted by number of bits
  • 2. When addition or any other operations exceeds these values:

unpredictable results

  • 3. This is Overflow: more bits are required for outcome than are

available

  • 4. Solution: add bits, or else?

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 38

slide-39
SLIDE 39

CS149: Elements of Computer Science Short Excursion into Hexadecimal notation

  • 1. Too many 0s and 1s! Convenient base 16 representation of numbers.
  • 2. Problem: we do not have 16 characters for a base 16 notation!

(a) 0 → 9 + {A, B, C, D, E, F} (b) A=10, B =11, etc. (c) Example: 14 (base 16) = 20 (base 10) (d) ASCII: M

  • i. bin=01001101
  • ii. DEC=77
  • iii. HEX=4D

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 39

slide-40
SLIDE 40

CS149: Elements of Computer Science Excess notation: another way to represent negative numbers

bin b10 excess 4 000

  • 4

001 1

  • 3

010 2

  • 2

011 3

  • 1

100 4 101 5 1 110 6 2 111 7 3

  • 1. Based on subtracting 2n from all num-

bers (a) Most significant bit indicates sign (1=+) (b) Starts from −2n and up

  • 2. Labeled excess 4, 8, etc according to

2n = 4 or 8

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 40

slide-41
SLIDE 41

CS149: Elements of Computer Science Fractions

  • 1. Same notation as base 10
  • 2. notation: ’x.y’, x = positive powers of 10, y=negative powers of 10
  • 3. Example: 45.67 = 4×101 +5×100 +6×10−1 +7×10−2

Or: 4×10+5×1+6× 1

10 +7× 1 100.

  • 4. Binary: 100.01 = 1×22 +0×21 +0×20 +0×2−1 +1×2−2

Or: 1×4+0×2+0×20 +0× 1

2 +1× 1 4

= 4+0.25 = 4.25

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 41

slide-42
SLIDE 42

CS149: Elements of Computer Science OK, one more: Floating Point Notation

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 42

slide-43
SLIDE 43

CS149: Elements of Computer Science

  • 1. Number is stored as bit

sequence

  • 2. Separated in three com-

ponents: (a) Sign Bit: 0=+, 1=- (b) Exponent: radix point shift (c) Mantissa: base number

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 43

slide-44
SLIDE 44

CS149: Elements of Computer Science Binary Example

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 44

slide-45
SLIDE 45

CS149: Elements of Computer Science Conversion to Floating Point

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 45

slide-46
SLIDE 46

CS149: Elements of Computer Science Truncation Errors

  • 1. Consider -3.125:

base 2 = 11.001 (a) Mantissa = 11001 (b) 4 bits for mantissa: 1100 (c) Exponent: 010 (d) Sign bit: 0

  • 2. Resulting notation: 1 010 1100
  • 3. This is not -3.125, but three!
  • 1. How would we represent 1/3?
  • 2. Or π?

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 46

slide-47
SLIDE 47

CS149: Elements of Computer Science Conclusion: Number representation

  • 1. Integers:

(a) Unsigned: standard binary nota- tion (b) Signed:

  • i. Two’s Complement Notation
  • ii. Excess Notation
  • 2. Fractions:

(a) Unlimited bits: Use of radix point (b) Limited Bits: Floating Point Some notes:

  • 1. Overflow in Two’s com-

plement

  • 2. Truncation in Floating

Point

  • 3. = Important errors in

programming!

  • 4. Use is determined by

nature of data

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 47

slide-48
SLIDE 48

CS149: Elements of Computer Science Exercise your skills

  • http://www.cs.odu.edu/˜jbollen/CS149/demos.html

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 48

slide-49
SLIDE 49

CS149: Elements of Computer Science Image Representation

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 49

slide-50
SLIDE 50

CS149: Elements of Computer Science Image Representation

  • 1. Two Basic methods:

(a) Bitmap: GIF, JPEG, TIFF, PNG, etc. (b) Vector: proprietaty formats, Coreldraw, CAD, VRML

  • 2. Bitmap: series of bits represent color values of image
  • 3. Vector: description of discrete components of image

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 50

slide-51
SLIDE 51

CS149: Elements of Computer Science Image Representation: Bit Maps

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 51

slide-52
SLIDE 52

CS149: Elements of Computer Science

11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111 11111111111100000011000000111111111111111111111111 11111111111110000001100000111100000111111111111111 11111110000011000000000000111000001111111111111111 11111111000000000000000000010000001111111111111111 11111100000000000000000000000000010000000001111111 11111110000000000000000000000000000000000111111111 11111100000000000000111111111000000000000000011111 11000000000000000011111111111111000000000000011111 11100000000000000111111111111111100000000000001111 11111100000000000111111101111111100000000000011111 11111111110000000011111111111111100000000000111111 11111100001100000001111111111111000000000000000111 11111111111000000000000111111100000001111111100111 11111111100000000000000000000000000000001111111111 11111100001000000000000000000000000000000011111111 11111111111000000000000000000000000000001100111111 11111111111111000000000000000000000011001111111111 11111111111111111111100000010000010001111111111111 11111111111111111111110000100100011111111111111111 11111111111111111111111101100111111111111111111111 11111111111111111111111111110011111111111111111111 01001111111111111111111111111000111111111111111111

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 52

slide-53
SLIDE 53

CS149: Elements of Computer Science Image Representation: Resolution in bitmaps

  • 1. Resolution:

(a) Number of pixels (picture ele- ments) per inch (b) Color Depth: black-white=1bit per pixel, 256 shades of gray: 1 byte per pixel, etc.

  • 2. More:

more detail in image, more memory

  • 3. Less: less detail in image, requires less

memory

  • 4. Use:

(a) Photos (b) Any image that contains compo- nents that can not be symbolically represented

  • 1. Disadvantages:

(a) Size: square grid times colordepth (b) Can not be transformed to sym- bolic representation

  • i. Necessary for editing of objects

and pattern recognition

  • ii. What is a circle?

Square? Move which object where?

  • iii. Bitmap representation specifies

how image looks, not what it is

  • r what image contains

(c) Scale dependent

  • i. Can not exceed maximum res-
  • lution
  • ii. Rescaling = quality loss

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 53

slide-54
SLIDE 54

CS149: Elements of Computer Science Image Representation: Vector technique

  • 1. Symbolic Description of image:

(a) Circles, squares, lines, etc. (b) Image is recreated from this description at display-time (c) Representation is really description of image, not actual image

  • 2. Uses:

(a) Design of artificial images (b) Image Compression (c) Postscript documents, fonts, etc.

  • 3. Advantages:

(a) Can be more efficient representation (b) Can be manipulated on object level (c) Can be converted to bitmap representation (d) Infinite Resolution

  • 4. Examples:

January 18, 2004

Johan Bollen - http://www.cs.odu.edu/˜jbollen

Page 54