1 of 77

ELEN0450 · Multimedia Systems

Lecture 2

Graphics and image data representation

How a picture becomes numbers:

sampling, bit depth, and file formats

www.viulab.be

2 of 77

Recap: where we are in the pipeline

2

Last lecture: one media signal from capture to display, in five stages.

Acquisition (Capture), Representation (Digitization), Compression (Storage),

Distribution (Transmission), Display (Render).

This lecture: the synthesis and representation (digitization) stage, for the image signal.

Reminder

Representation

Digitization

Acquisition Capture

Compression Storage

Distribution Transmission

Display

Render

3 of 77

Scope of the course

3

Analog path

Digital path

Physical scene

Light, sound, motion

Capture

Lens, sensor, microphone

Analog signal

Continuous in time and amplitude

Analog storage and transport

Film, vinyl, tape, broadcast

Rendering

Display, loudspeaker, print

Synthesis

Graphics, audio, generative

Digital signal representation

ADC, samples,

pixels, bit depth

Source coding

compression

JPEG, AAC, MP4

Storage

Container, disc, network

Transmission and decoding

Network, Inverse transform, DAC

Human perception

Visual and auditory systems

Sampling and quantization

Perceptual models drive the coding stage: chroma subsampling, quantization tables, masking thresholds

Scope

4 of 77

What you'll be able to do after today's class

4

Explain image sampling and intensity quantization.

Compute storage from resolution and bit depth

Distinguish 1-bit, gray, 24-bit and indexed color

Build a palette with median-cut and dither an image

Compare raster with vector and the main file formats

Objective

5 of 77

Table of content

5

Images as sampled signals

– Pixels and I(x,y)

– Sampling and quantization

– Resolution

– Upsampling and downsampling

Image types and bit depth

– 1 / 8 / 24-bit images

– Indexed color and LUTs

Dithering

– Ordered and error diffusion

Raster vs vector

– Two ways to describe a picture

– Bezier curves

– 3D data

File formats

– PPM, GIF, PNG, TIFF, JPEG, HEIF

ELEN0450 · Multimedia Systems

1

Basics of multimedia

2

Graphics & image representation

3

Colorimetry & color spaces

4

Analog image & video

5

Camera model & digital sensors

6

Analog and digital displays

7

Acoustics, microphones & speakers

8

Audio digitization & compression

9

Digital image compression

10

Digital video compression

11

Transmission protocols

12

Internet distribution

6 of 77

An optical signal is 2D continuous

6

Lights in the physical scene is continuous in 3 dimensions and time.

A camera projects that 3D continuous light on a 2D continuous sensor (more on this is Session 4 and 5)

Property

7 of 77

An optical signal is 2D continuous

7

 

Definition

8 of 77

Digital sensors filter and sample the 2D continuous signal

8

The image sensor filter samples the continuous 2D signal into a discretized 2D signal.

Single elements integrate the signal within it (“counting photons”).

Idea

9 of 77

An image is a grid of pixels

9

 

Definition

10 of 77

An image is a function

10

 

Definition

 

 

11 of 77

Representations of images

 

11

12 of 77

Digitization is sampling plus quantization

12

Sampling: read the value at regular instants (discretize TIME).

Quantization: round each sample to a finite level set (discretize AMPLITUDE).

Quantization and sampling are steps that lose information.

Definition

Result

Reminder

13 of 77

Spatial sampling: onto a grid

13

The real scene is continuous; the sensor measures one value per grid cell.

One value per cell is one pixel. A finer grid gives higher spatial resolution.

Idea

14 of 77

Intensity quantization

14

 

Idea

15 of 77

Image properties: resolution, aspect ratio, and density

Spatial resolution: how many pixels, width by height, in pixels (e.g., 1920 by 1080).

Aspect ratio: width to height ratio (e.g., 4:3 for early TV, 16:9 for HD).

Pixel density: pixels per inch on a device (also called dpi (dots per inch) for printers).

Color resolution: how many levels per pixel (bit depth).

 

Example

 

Mathematical demo

Demonstrate that (on the board)

Properties

Spatial and color resolutions cost storage.

16 of 77

Upsampling and downsampling the spatial resolution

16

Theoretically optimal upsampling: first reconstruct the underlying continuous signal through a filter, with potential anti-aliasing, and then resample at a desired, higher rate.

Idea

Original signal

Upsampled points

Underlying continuous signal

 

17 of 77

Upscaling = reducing frequency + upsampling

17

 

First “stretch” the underlying signal into a wider domain, which reduces the signal frequency

Then we sample that lower frequency signal with more samples.

This makes later reconstruction (e.g., by a display) easier in theory.

Idea

18 of 77

Naïve upsampling

18

Nearest neighbor

 

 

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

“Zero-upsampling”

 

 

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

19 of 77

Visualization of upsampling strategies

19

Nearest neighbors

Bilinear

Cubic

2D interpolation

20 of 77

Downscaling = Increasing frequency + downsampling

20

Simply dropping samples/pixels? Why is that bad?

  • Dropping pixels is equivalent to sampling the original continuous signal using a lower rate. It would make later reconstruction harder and may lead to aliasing.
  • First “squeeze” the underlying signal into a narrower domain, which increases the signal frequency.
  • Then we sample that higher frequency signal with fewer samples.

Displaying the image at the downsampled resolution is very hard: it is equivalent to reconstructing a higher frequency signal from fewer samples.

Idea

 

21 of 77

A warning: sampling artifacts

21

Sample a pattern finer than the grid and you get moire (aliasing).

Same cause as audio aliasing: undersampling.

Cameras add an optical low-pass filter to fight it.

Note

22 of 77

Table of content

22

Images as sampled signals

– Pixels and I(x,y)

– Sampling and quantization

– Resolution

– Upsampling and downsampling

Image types and bit depth

– 1 / 8 / 24-bit images

– Indexed color and LUTs

Dithering

– Ordered and error diffusion

Raster vs vector

– Two ways to describe a picture

– Bezier curves

– 3D data

File formats

– PPM, GIF, PNG, TIFF, JPEG, HEIF

ELEN0450 · Multimedia Systems

1

Basics of multimedia

2

Graphics & image representation

3

Colorimetry & color spaces

4

Analog image & video

5

Camera model & digital sensors

6

Analog and digital displays

7

Acoustics, microphones & speakers

8

Audio digitization & compression

9

Digital image compression

10

Digital video compression

11

Transmission protocols

12

Internet distribution

23 of 77

The image types at a glance

23

Bit depth relates to color precision. More bits give more colors but require more storage.

Idea

24 of 77

1-bit images

24

1 bit per pixel: black or white only (a binary or monochrome image).

Used in fax, line art, some video games, printers, and masks.

Smallest possible; needs dithering for tone (later).

Definition

25 of 77

1-bit video games

25

26 of 77

8-bit gray-level images

26

 

Definition

27 of 77

Bit-planes: where do the structure live?

 

Property

28 of 77

24-bit color images

 

Definition

29 of 77

Higher bit-depth: medical and multispectral

 

Property

30 of 77

8-bit indexed color

 

Definition

Image source: « Le Labo du Jeu Video » David Louapre

31 of 77

Color Look-Up Tables (LUTs)

 

Idea

32 of 77

Example of color by number

32

Example

33 of 77

Use case of LUTs and palette animation: the Game Boy

33

34 of 77

Devising a LUT: the median-cut algorithm

 

Algorithm

35 of 77

Example of the median cut algorithm

35

Example

36 of 77

Example on a real image

36

Example

Images in JPEG format support 16 million colors, a good approximation to the natural range of human vision.

The same image in GIF format, which supports only 256 colors. You can see bands of flat color where regions have been reduced to an average for a range.

Image source: Gabriel Ytterberg on Medium

37 of 77

Storage for different bit depth

 

Example

38 of 77

Table of content

Images as sampled signals

– Pixels and I(x,y)

– Sampling and quantization

– Resolution

– Upsampling and downsampling

Image types and bit depth

– 1 / 8 / 24-bit images

– Indexed color and LUTs

Dithering

– Ordered and error diffusion

Raster vs vector

– Two ways to describe a picture

– Bezier curves

– 3D data

File formats

– PPM, GIF, PNG, TIFF, JPEG, HEIF

ELEN0450 · Multimedia Systems

1

Basics of multimedia

2

Graphics & image representation

3

Colorimetry & color spaces

4

Analog image & video

5

Camera model & digital sensors

6

Analog and digital displays

7

Acoustics, microphones & speakers

8

Audio digitization & compression

9

Digital image compression

10

Digital video compression

11

Transmission protocols

12

Internet distribution

39 of 77

Dithering (Halftone printing)

A 1-bit printer has only ink or no-ink yet is able to show grey photos.

  • Halftone dither: vary dot size.
  • Ordered dither: vary dot density.

Dithering trades intensity resolution for spatial resolution.

Problem statement

40 of 77

Dithering in classic games

40

41 of 77

Dithering

 

Algorithm

 

 

 

 

 

42 of 77

Ordered dithering

  • ORDERED-DITHER(I, D, n)
    • for x=0 to xmax do
    • for y=0 to ymax do
      • i = x mod n
      • j = y mod n
      • // I(x,y) rescaled to the range 0 .. n²
      • if I(x,y) > D(i,j) then
        • O(x,y) = 1 // white
      • else
        • O(x,y) = 0 // black

 

Algorithm

43 of 77

Error diffusion dithering

Round each pixel, then push the rounding ERROR onto neighbors not yet processed.

Errors cancel on average, so there is no fixed pattern and the result looks finer.

Idea

44 of 77

Ordered vs error diffusion

Ordered: fast, fixed pattern, tileable, good for print and hardware.

Error diffusion: slower, adaptive, best quality, good for on-screen.

Both fake tone the device cannot natively show.

Property

45 of 77

Color depth in practice

Early computers climbed from 1-bit to 16 colors to the 256-color VGA palette.

'True color' is 24-bit; '32-bit' is 24-bit plus an 8-bit alpha channel.

Modern displays use 10 to 12 bits per channel (revisited with video).

Note

46 of 77

Table of content

Images as sampled signals

– Pixels and I(x,y)

– Sampling and quantization

– Resolution

– Upsampling and downsampling

Image types and bit depth

– 1 / 8 / 24-bit images

– Indexed color and LUTs

Dithering

– Ordered and error diffusion

Raster vs vector

– Two ways to describe a picture

– Bezier curves

– 3D data

File formats

– PPM, GIF, PNG, TIFF, JPEG, HEIF

ELEN0450 · Multimedia Systems

1

Basics of multimedia

2

Graphics & image representation

3

Colorimetry & color spaces

4

Analog image & video

5

Camera model & digital video

6

Analog and digital displays

7

Acoustics, microphones & speakers

8

Audio digitization & compression

9

Digital image compression

10

Digital video compression

11

Transmission protocols

12

Internet distribution

47 of 77

Raster vs vector

Raster files are images built from pixels, tiny color squares that, in great quantity, can form highly detailed images such as photographs.

Vector files use mathematical equations, lines, and curves with fixed points on a grid to produce an image. There are no pixels in a vector file.

Definition

48 of 77

Vector primitives in 2D

Vector primitives store control points and equations: lines, curves, polygons, fills.

Resolution-independent: rendered ('rasterised') on demand at any size.

Idea

49 of 77

Fonts, metafiles and SVG

Fonts store glyph outlines as curves, so text scales to any size.

  • Windows WMF and EMF are vector metafiles: recorded Windows GDI drawing calls.
  • SVG is the open XML vector format of the web.

Example

50 of 77

Parametric curve

50

 

Definition

51 of 77

Bezier curve

51

Bezier curve: is a kind of parametric curve expressed as a weighted sum of a set of control points.

Weights are given by the Bernstein polynomial.

Definition

52 of 77

Quadratic Bezier curve

52

53 of 77

Nth order Bezier curve

53

 

Property

 

 

 

Basis functions: Bernstein polynomials

54 of 77

When to use which image representation

Raster: photographs, anything with continuous tone or texture.

Vector: logos, icons, text, diagrams, maps, anything that must scale.

Many real files mix both (a PDF page can do both).

Property

55 of 77

Reminder: 2D data representation

55

Images and videos have a unique representation

Videos

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

 

 

 

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

 

Images

Reminder

56 of 77

Various 3D data representation

56

Unlike spatial 2D data (images, video), spatial 3D data can be represented in many ways

Point clouds

Voxel grid

Meshes

Signed distance function

RGB-D

Multi-view

Each representation is best suited for a particular tasks and geometric structures

57 of 77

Voxel grid representation

57

Voxel grid representation is a method for modeling 3D objects where the space is divided into a regular grid of cubes, known as voxels (volume elements).

  • Each voxel in the grid can store information such as color, density, or material properties.

 

Zhengren Wang. 3D Representation Methods: A Survey

Idea

58 of 77

Point cloud representation

58

 

Problems:

  • Often noisy due to the capture method
  • Difficult to draw in undersampled regions
  • No easy simplification or subdivision
  • No smooth rendering
  • No topological information

Idea

59 of 77

Mesh representation

59

Mesh represents objects by their boundaries with either triangles or quads

  • Modular representation: can be subsampled to only keep the overall shape
  • At the basis of any modern rendering pipeline and game engine
  • Can use Bezier surfaces

Idea

60 of 77

Table of content

Images as sampled signals

– Pixels and I(x,y)

– Sampling and quantization

– Resolution

– Upsampling and downsampling

Image types and bit depth

– 1 / 8 / 24-bit images

– Indexed color and LUTs

Dithering

– Ordered and error diffusion

Raster vs vector

– Two ways to describe a picture

– Bezier curves

– 3D data

File formats

– PPM, GIF, PNG, TIFF, JPEG, HEIF

ELEN0450 · Multimedia Systems

1

Basics of multimedia

2

Graphics & image representation

3

Colorimetry & color spaces

4

Analog image & video

5

Camera model & digital sensors

6

Analog and digital displays

7

Acoustics, microphones & speakers

8

Audio digitization & compression

9

Digital image compression

10

Digital video compression

11

Transmission protocols

12

Internet distribution

61 of 77

What is an image format?

61

An image file format is a way of storing digital pictures using specific rules for compression, color, and data structure.

Definition

62 of 77

Anatomy of an image file

Header (e.g., size, bit depth, color type), then pixel data (often compressed), then metadata.

Idea

63 of 77

RAW format

63

High-quality digital image format used in professional photography as it captures all the unprocessed data directly from a camera sensor.

  • Preserve maximal details, color depth and dynamic range, ideal for post-processing.
  • But it is large in size and require specialized software to be read and visualized.

Overview

64 of 77

The simplest format: Netpbm (PBM / PGM / PPM)

PBM (Portable Bit Map) is a bitmap, PGM (Portable Gray Map) a graymap, PPM (Portable PixMap) a pixmap; an open family (Unix).

  • A plain-text PPM header: P1/P3, then width height, then 255, then R G B triples.
  • ASCII or raw binary; no real compression, but easy to read and write.

Overview

65 of 77

Windows BMP

Microsoft's native bitmap (also called DIB): header, optional palette, pixel rows.

Uses run-length encoding or is stored uncompressed.

Found on Windows; a poor choice for the web due to large file size.

Overview

66 of 77

Animated GIF format

Stores multiple images, so used for animation

8-bit indexed; a global color map, with optional local maps per image.

Pixel indices compressed with LZW (dictionary coding, see ELEN0060).

Only 256 colors per frame, which is why GIFs of photos look posterized.

Overview

67 of 77

PNG: the modern lossless format

PNG: gray, indexed or true color, up to 16 bits per channel (48-bit).

A full alpha channel and Lossless so used for keeping sharp details (e.g., logos, icons, etc.).

More in Session 9

Overview

68 of 77

TIFF and JPEG

TIFF: a flexible, tag-based container; originally lossless. Supports multiple layers.

JPEG: lossy, DCT-based, the photo standard; built in Sessions 9.

But, much more efficient than PNG for real images!

Looses details

Overview

69 of 77

EXIF: the metadata

EXIF records camera metadata inside JPEG files.

Book fields: exposure, light source and flash, white balance, scene type.

Cameras add more (aperture, ISO, lens, date, GPS); the GPS tag is a privacy point.

Overview

70 of 77

HEIF: still images from a video codec

HEIF is the still-image version of HEVC (H.265); Apple uses it to replace JPEG.

A flexible container: image sequences, depth, thumbnails, audio; up to 14-bit; transparency.

About half the size of JPEG at almost imperceptible quality change.

Overview

71 of 77

Newer formats: WebP and AVIF

Note

WebP (2010): lossy and lossless, alpha and animation in one format. Fast loading for the web thanks to its high compression rate.

AVIF (2019): still images built on the AV1 video codec, very small files.

Better prediction and entropy coding underneath.

72 of 77

SVG and EPS

72

Scalable Vector Graphics (SVG) is a vector graphic format. Images are stored as mathematical shapes, not individual pixels. Remain sharp at any size.

Encapsulated PostScript (EPS). Similar to SVG. Can support both vector and bitmap elements. Replaced by PDF. Remains used in high-resolution printing.

Overview

73 of 77

Choosing a format

Photograph? Use JPEG or HEIF.

Sharp graphics, text or alpha? Use PNG or SVG.

Animation? GIF or WebP.

Must not lose data? PNG or TIFF.

Ask yourself : continuous-tone or not, need transparency, need to scale?

Idea

74 of 77

Formats at a glance

Format

Color

Compression

Best for

PPM/BMP

gray or true

none or RLE

simple I/O, learning

GIF

8-bit indexed

lossless (LZW)

animation, simple graphics

PNG

gray/indexed/true

lossless

graphics, screenshots, alpha

TIFF

flexible

lossless or none

print, archival

JPEG / HEIF

24-bit / more

lossy

photographs

➤ Photos: JPEG or HEIF. Graphics and alpha: PNG. Animation: GIF. Archival: TIFF.

Reminder

75 of 77

Summary

An image is a sampled grid (space) of quantized values (amplitude)

Bit depth: 1, 8, 24 bits; indexed color with a median-cut LUT saves about 3 times storage

Dithering fakes tone; raster differs from vector, which scales

Raster versus vector images

Formats package it: PPM, BMP, GIF, PNG, TIFF, JPEG, HEIF, plus EXIF, PS/PDF, PTM

Summary

76 of 77

Image: where each stage lands

Stage

Analog

Digital

Transduction

Lens, film emulsion (silver halide)

Lens, colour filter array, CMOS or CCD sensor

Representation

Continuous 2D density on film

Pixel grid, RGB or Y'CbCr, 8 to 16 bit

Digitisation

Grain and lens MTF set the resolution limit

Sensor grid sampling, optical low pass filter

Coding

​

JPEG (DCT), JPEG 2000 (wavelet), PNG, WebP, AVIF

Storage media

Negative, slide, print

Flash, HDD, SSD, cloud object storage

Transmission

Wirephoto, fax over the telephone line

IP transfer, web, messaging

Distribution

Physical prints, press circulation

CDN, social platforms, thumbnails on demand

Rendering

Enlarger print, projector

LCD or OLED display, inkjet, ICC colour management

Perception

Human visual system

Overview

76

77 of 77

Table of content

Images as sampled signals

– Pixels and I(x,y)

– Sampling and quantization

– Resolution

– Upsampling and downsampling

Image types and bit depth

– 1 / 8 / 24-bit images

– Indexed color and LUTs

Dithering

– Ordered and error diffusion

Raster vs vector

– Two ways to describe a picture

– Bezier curves

– 3D data

File formats

– PPM, GIF, PNG, TIFF, JPEG, HEIF

ELEN0450 · Multimedia Systems

1

Basics of multimedia

2

Graphics & image representation

3

Colorimetry & color spaces

4

Analog image & video

5

Camera model & digital sensors

6

Analog and digital displays

7

Acoustics, microphones & speakers

8

Audio digitization & compression

9

Digital image compression

10

Digital video compression

11

Transmission protocols

12

Internet distribution