Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

54
Bit Depth and Spatial Bit Depth and Spatial Resolution Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT
  • date post

    18-Dec-2015
  • Category

    Documents

  • view

    217
  • download

    1

Transcript of Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Page 1: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Bit Depth and Spatial ResolutionBit Depth and Spatial Resolution

SIMG-201 Survey of Imaging Science

© 2002 CIS/RIT

Page 2: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Binary ImagesBinary Images

The simplest digital images are binary images. Binary images contain only one bit per pixel, so they can only represent two gray values. For example;

0 = black

1 = white

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

1 1 1 1 1 1 1 1 1 0 0 0 0 0 0

1 1 1 1 1 1 1 1 1 1 1 0 0 0 0

1 1 1 1 1 1 1 1 1 1 1 0 0 0 0

Page 3: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Computer Memory & StorageComputer Memory & Storage

If we want an image that has more than two gray levels, we have to increase the number of ‘bits per pixel’

binary: just white or black grayscale: many shades of gray

Page 4: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Computer Memory & StorageComputer Memory & Storage

0 0

0 1

1 0

1 12x2 = 4 gray levels

2 gray levels

0

1

1 bitpixel

2 bitspixel

Page 5: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Computer Memory & StorageComputer Memory & Storage

2x2x2 = 8 gray levels

3 bitspixel

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

Page 6: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Computer Memory & StorageComputer Memory & Storage

0 0 0 = 0

0 0 1 = 1

0 1 0 = 2

0 1 1 = 3

1 0 0 = 4

1 0 1 = 5

1 1 0 = 6

1 1 1 = 7

. . . = .

We started to look at the bits as tokens to represent different values, but we ended up with a binary counting system.

The largest number we can count to (and the number of different gray levels we can have) depends on how many bits we use.

Page 7: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Grayscale images Grayscale images

To get more than two gray values, we need a code with more than one bit per pixel.

1 bit 2 bits 3 bits

0 00 000

1 01 001

(2 values) 10 010

11 011

(4 values) 100

101

110

111

(8 values)

Page 8: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Binary ArithmeticBinary Arithmetic

In binary arithmetic, we can only count from 0 to 1 before we have to ‘carry’

0

1

binary

0

1

decimal

1 bit

Page 9: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Binary ArithmeticBinary Arithmetic

In binary arithmetic, we can only count from 0 to 1 before we have to ‘carry’

Two bits allows four grayscale codes: Note that the code changes; the meaning of ‘1’ changes from white to dark gray.

0

1

10

11

binary

0

1

2

3

decimal

1 bit

2 bits

Page 10: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Binary ArithmeticBinary Arithmetic

In binary arithmetic, we can only count from 0 to 1 before we have to ‘carry’

Two bits allows four grayscale codes: Note that the code changes; the meaning of ‘1’ changes from white to dark gray.

Three bits allows eight grayscale codes: The code changes again: ‘1’ is now almost black.

0

1

10

11

100

101

110

111

binary

0

1

2

3

4

5

6

7

decimal

1 bit

2 bits

3 bits

Page 11: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Binary ArithmeticBinary Arithmetic0

1

10

11

100

101

110

111

1000

1001

1010

1011

1100

1101

1110

1111

10000...

binary

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16...

decimal

1 bit

2 bits

3 bits

4 bits

In binary arithmetic, we can only count from 0 to 1 before we have to ‘carry’

Two bits allows four grayscale codes: Note that the code changes; the meaning of ‘1’ changes from white to dark gray.

Three bits allows eight grayscale codes: The code changes again: ‘1’ is now almost black.

Page 12: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Computer Memory & StorageComputer Memory & Storage

3 bits/pixel: 8 gray levels

000 111

(0 7)

4 bits/pixel: 16 gray levels

0000 1111

(0 15)

Page 13: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Computer Memory & StorageComputer Memory & Storage

5 bits/pixel: 32 gray levels

00000 11111

(0 31)

8 bits/pixel: 256 gray levels

00000000 11111111

(0 255)

Page 14: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Grayscale ImagesGrayscale Images

The number of gray levels that can be represented is fixed by the bit depth, the number of bits per pixel used to store the gray value.

1 bit/pixel : 2 values (‘binary’) [0, 1]

2 bits/pixel : 4 values [00, 01, 10, 11]

3 bits/pixel : 8 values[000, 001, 010, …]

4 bits/pixel : 16 values[0000, 0001, 0010, …]

Page 15: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Grayscale ImagesGrayscale Images

The number of gray levels that can be represented is fixed by the bit depth, the number of bits per pixel used to store the gray value.

5 bits/pixel : 32 values

6 bits/pixel : 64 values

7 bits/pixel:128 values

8 bits/pixel : 256 values

Page 16: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Bit depth: bits per pixelBit depth: bits per pixel

The number of possible gray levels is controlled by the number of bits/pixel, or the ‘bit depth’ of the image

gray levelsgray levels

22

44

88

1616

3232

6464

128128

256256

bits/pixel

1

2

3

4

5

6

7

8

Page 17: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Memory requirements: Bit depthMemory requirements: Bit depth

Adding more gray levels is ‘cheap’ in terms of memory requirements. Every added bit doubles the number of gray levels

Grayscale Values vs. Bit Depth

0

64

128

192

256

1 2 3 4 5 6 7 8

bits per pixel

gray levels

Page 18: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Digital images: FundamentalsDigital images: Fundamentals

39

56

45

75

62

99

64

101

228 178 106 193

183 143 84 162

A digital image is an ‘ordered array’ of numbers

Each pixel (picture element) in a grayscale digital image is a number that describe the pixel’s lightness

(e.g., 0 = black 255 = white)

Page 19: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Grayscale ImagesGrayscale Images

Grayscale images commonly have 256 different gray values, numbered 0 - 255. Each pixel can then be stored in 8 bits, or 1 byte. [00000000 11111111]

0 = black 255 = white

Grayscale pixels are sometimes stored with as many as 1024 gray values (10 bits) or 4096 gray values (12 bits) This doesn’t make the image ‘look better’ but it increases the lightness range that can be captured

Page 20: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Bit depth & spatial resolutionBit depth & spatial resolution

The bit depth describes the ‘grayscale resolution’

- with what precision are gray values distinguished?

2 bit

0

50

100

150

200

250

300

0 50 100 150 200 250 300

2 bit

Page 21: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Bit depth & spatial resolutionBit depth & spatial resolution

The bit depth describes the ‘grayscale resolution’

- with what precision are gray values distinguished?

2 bit

0

50

100

150

200

250

0 50 100 150 200 250 300

2 bit

Page 22: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Bit depth & spatial resolutionBit depth & spatial resolution

3 bit

0

50

100

150

200

250

300

0 50 100 150 200 250 300

3 bit

The bit depth describes the ‘grayscale resolution’

- with what precision are gray values distinguished?

Page 23: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Bit depth & spatial resolutionBit depth & spatial resolution

8 bit

0

50

100

150

200

250

300

0 50 100 150 200 250 300

8 bit

The bit depth describes the ‘grayscale resolution’

- with what precision are gray values distinguished?

Page 24: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Bit depth & spatial resolutionBit depth & spatial resolution

0

50

100

150

200

250

300

0 50 100 150 200 250 300

8 bit

3 bit

2 bit

The bit depth describes the ‘grayscale resolution’

- with what precision are gray values distinguished?

2 3 8 bits/pixel

Page 25: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Bit depth & spatial resolutionBit depth & spatial resolution

Spatial resolution

- with what precision are spatial variations reproduced?

Page 26: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Image Resolution: Image Resolution: 4 x 3 Pixels4 x 3 Pixels

Page 27: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Image Resolution: Image Resolution: 8 x 6 Pixels8 x 6 Pixels

Page 28: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Image Resolution: Image Resolution: 16 x 12 Pixels16 x 12 Pixels

Page 29: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Image Resolution: Image Resolution: 32 x 24 Pixels32 x 24 Pixels

Page 30: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Image Resolution: Image Resolution: 64 x 48 Pixels64 x 48 Pixels

Page 31: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Image Resolution: Image Resolution: 128 x 96 Pixels128 x 96 Pixels

Page 32: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Image Resolution: Image Resolution: 160 x 120 Pixels160 x 120 Pixels

Page 33: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Image Resolution: Image Resolution: 320 x 240 Pixels320 x 240 Pixels

Page 34: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Image Resolution: Image Resolution: 640 x 480 Pixels640 x 480 Pixels

Page 35: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Image Resolution: Image Resolution: 1280 x 960 Pixels*1280 x 960 Pixels*

Page 36: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Spatial Sampling & File SizeSpatial Sampling & File Size

Doubling the linear image sampling rate renders more image detail, but quadruples the file size.

64X

256X

1

1 2 3 45 6 7 8

9 10 11 12

13 14 15 16

1 23 4

Page 37: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

The eyes have three different kinds of color receptors; One kind is most sensitive to short wavelengths, one to middle wavelengths, and one to long wavelengths

Vision – The EyeVision – The Eye

Page 38: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

RGB Color ImagesRGB Color Images

Each one of the color images (‘planes’) is like a grayscale image, but is displayed in R, G, or B

=

The most straightforward way to capture a color image is to capture three images; one to record how much red is at each point, another for the green, and a third for the blue.

Page 39: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Color images: 24-bit RGB Color images: 24-bit RGB

Color images also need to be coded The bit depth in a color image determines the number

of colors that can be assigned to a given pixel. One common format is the 24-bit RGB image, with

three 8-bit planes; Red, Green, and Blue; 16.7M colors

=

(256 x 256 x 256 = 16.7 million)

Page 40: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

RGB Color Images: 24-bit colorRGB Color Images: 24-bit color

Every pixel in each of the three 8-bit color planes can have 256 different values (0-255)

If we start with just the blue image plane, we can make 256 different “colors of blue”

0

255

Page 41: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

RGB Color Images: 24-bit colorRGB Color Images: 24-bit color

Every pixel in each of the three 8-bit color planes can have 256 different values (0-255)

If we start with just the blue image plane, we can make 256 different “colors of blue”

If we add red (which alone gives us 256 different reds): 0 255

0

255

Page 42: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

RGB Color Images: 24-bit colorRGB Color Images: 24-bit color

Every pixel in each of the three 8-bit color planes can have 256 different values (0-255)

If we start with just the blue image plane, we can make 256 different “colors of blue”

If we add red (which alone gives us 256 different reds):

We can make 256 x 256 = 65,536 combination colors because for every one of the 256 reds, we can have 256 blues.

0 255

0

255

Page 43: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

RGB Color Images: 24-bit colorRGB Color Images: 24-bit color

When we have all three colors together, there are 256 possible values of green for each onefor each one of the 65,536 combinations of red and blue:

256 x 256 x 256 = 16,777,216 (“> 16.7 million colors”)

Page 44: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

RGB Color Images: 24-bit colorRGB Color Images: 24-bit color

The numbers stored for each pixel in a color image contain the color of that pixel

Page 45: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Color Image = Red + Green + BlueColor Image = Red + Green + Blue

=

In a 24-bit image, each pixel has R, G, & B values When viewed on a color display, the three images are

combined to make the color image.

212100139196

16375113149

37446372

95118155170

189

162

38

41608278

182

161

50

43576863

Page 46: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Indexed Color ImagesIndexed Color Images

A small subset of the 16 million colors can often be used instead of the full 24 bits --256 colors is often sufficient if the colors are chosen carefully

Indexed color images take advantage of this fact to use less memory or work with displays that can’t show 24-bit images

Page 47: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Indexed Color imagesIndexed Color images

24 bit

8-bit“adaptive”8-bit “system”

Page 48: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

Color images: Index Color Color images: Index Color

A more compact code can be created for color images by making a look-up-table of colors for use in an image. Indexed color images store a fixed number of colors limited by the bit-depth:

3 bits/pixel : 8 colors

4 bits/pixel : 16 colors

5 bits/pixel:64 colors

8 bits/pixel : 256 colors

Page 49: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

File Size CalculationFile Size Calculation

100 pixels

100 pixels

Bit depth = 8 bits per pixel (256 gray levels)

File size (in bits) = Height x Width x Bit Depth

100 x 100 x 8 bits/pixel = 80,000 bits/image80,000 bits or 10,000 bytes

How much memory is necessary to store an image that is 100 x 100 pixels with 8 bits/pixel?

Page 50: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

File Size CalculationFile Size Calculation

1280 pixels

960 pixels

Bit depth = 24 bits per pixel (RGB color)

File size (in bits) = Height x Width x Bit Depth

960 x 1280 x 24 bits/pixel = 29,491,200 bits/image29,491,200 bits = 3,686,400 bytes = 3.5 MB

How much memory is necessary to store an image that is 1280 x 960 pixels with 24 bits/pixel?

Page 51: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

JPEG - Adobe PhotoShop “10” 324 KBRaw image = 3,686 KB

compressed/raw ~ 9%

Page 52: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

JPEG - Adobe PhotoShop “5” 70 KBRaw image = 3,686 KB

compressed/raw ~ 2%

Page 53: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

JPEG - Adobe PhotoShop “0” 32 KBRaw image = 3,686 KB

compressed/raw ~ 1%

Page 54: Bit Depth and Spatial Resolution SIMG-201 Survey of Imaging Science © 2002 CIS/RIT.

JPEG 324 KB

JPEG 70 KB

JPEG 32 KB

~ 9%

~ 2%

~ 1%