Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

1

Fundamentals of Multimedia

Lecture 4 –
MEDIA REPRESENTATION AND MEDIA FORMATS
(Cont.)

Fundamentals of Multimedia 2
Media Representation and Formats

 Text
 Digital Images
 Digital Video
 Digital Audio
 Graphics

Fundamentals of Multimedia 3
Image Dithering

 Dithering is often used for displaying monochrome images


 Dithering is used to calculate patterns of dots such that
values from 0 to 255 correspond to patterns that are more
and more filled at darker pixel values, for printing on a 1-bit
printer.

 To get color to black and white, first turn into gray scale.
I=0.299R+0.587G+0.114B
 This formula reflects the fact that green is more
representative of perceived brightness than blue is

Fundamentals of Multimedia 4
Image Dithering

 Reducing Effects of Quantization by Dithering


 Threshold dithering
 Error diffusion dither (Floyd-Steinberg)
 Ordered dithering
 Pattern dithering

Original (8 bits) Uniform Quantization (1 bit)


Floyd-Steinberg Error
Diffusion Dither (1 bit)
Fundamentals of Multimedia 5
Threshold Dithering
 For every pixel: If the intensity < 128, replace with black, else replace with white
 128 is the threshold
 This is the naïve version of the algorithm
 To keep the overall image brightness the same, you should:
 Compute the average intensity over the image
 Use a threshold that gives that average
 For example, if the average intensity is 150, use a threshold that is higher
than 150 replace with white, else replace with black

Original (8 bits) naïve version Brightness version


Introduction to Multimedia 6
Floyd-Steinberg Error Diffusion Dithering

 For each pixel in the image (8 bits image) do the following:


 Threshold the pixel (if pixelo >=128 → pixeln=255 else pixeln=0)
 Compute the error at that pixel: error = pixelo - pixeln
 Propagate the error to neighbors by adding some proportion of
the error to each unprocessed neighbor

A mask tells you how to distribute the error

Fundamentals of Multimedia 7
Floyd-Steinberg Error Diffusion Dithering

20<128
pixeln=0
error= 20-0=20
𝟕
𝟐𝟎 × + 𝟏𝟓𝟎 ≈ 𝟏𝟓𝟗
𝟏𝟔
𝟓
𝟐𝟎 × + 𝟏𝟓𝟎 ≈ 𝟏𝟓𝟔
𝟏𝟔
𝟏
𝟐𝟎 × + 𝟗𝟎 ≈ 𝟗𝟏
𝟏𝟔
159>=128
pixeln=255
error= 159-255=-96
𝟕
−𝟗𝟔 × + 𝟖𝟎 ≈ 𝟑𝟖
𝟏𝟔
𝟓
−𝟗𝟔 × + 𝟗𝟏 ≈ 𝟔𝟏
𝟏𝟔
𝟑
−𝟗𝟔 × + 𝟏𝟓𝟔 ≈ 𝟏𝟑𝟖
𝟏𝟔
𝟏
−𝟗𝟔 × + 𝟏𝟖𝟎 ≈ 𝟏𝟕𝟒
𝟏𝟔
38<128
pixeln=0
error= 38-0=38
𝟕
3𝟖 × + 𝟏𝟐𝟎 ≈ 𝟏𝟑𝟕
1. Threshold the pixel (if pixelo >=128 → pixeln=255 else pixeln=0) 𝟏𝟔
𝟓
2. Compute the error at that pixel: error = pixelo – pixeln 𝟑𝟖 ×
𝟏𝟔
+ 𝟏𝟕𝟒 ≈ 𝟏𝟖𝟔
3. Propagate the error to neighbors by adding some proportion of the error to 𝟑
𝟑𝟖 × + 𝟔𝟏 ≈ 𝟔𝟖
𝟏𝟔
each unprocessed neighbor 𝟏
𝟑𝟖 × + 𝟖𝟒 ≈ 𝟖𝟔
𝟏𝟔
Fundamentals of Multimedia 8
Ordered Dithering

 Break the image into small blocks (n x n)


 Define a threshold matrix (n x n):
Use a different threshold for each pixel of the block
Compare each pixel to its own threshold
(if pixelo >=Thr → pixeln=255 else pixeln=0)

Fundamentals of Multimedia 9
Example : Ordered Dithering

Fundamentals of Multimedia 10
Ordered Dithering

Fundamentals of Multimedia 11
Pattern Dithering

 Compute the intensity of each sub-block and index a pattern.

 NOT the same as before


 Here, each sub-block has one of a fixed number of patterns – pixel is determined
only by average intensity of sub-block
 In ordered dithering, each pixel is checked against the dithering matrix before being
turned on

Fundamentals of Multimedia 12
Pattern Dithering
𝟏
For 2 x 2 → 𝟐𝟐 +1=5 subblocks → = 𝟎. 𝟐
𝟓

𝟏
For 3 x 3 → 𝟑𝟐 +1=10 subblocks → = 𝟎. 𝟏
𝟏𝟎

Fundamentals of Multimedia 13
Example: Pattern Dithering

Step 1: 4 block

Step 2 : Calculate the average for each block


(20+150+150+90)/4=103 ÷ 255= 0.402 (80+120+180+84)/4=116 ÷ 255= 0.45
(50+178+235+128)/4=147.75 ÷ 255= 0.58 (16+200+190+70)/4=119 ÷ 255= 0.47
Step 3 : 255 0
255 0

0 255 0 255

→ 255 0 255 0

0 255 0 255
255

Fundamentals of Multimedia 14
Image Transition
 Image\Video Transitions: can be used in multimedia presentations to
signal scene changes .
 Many different types of transitions:
 Cut: sudden change of image contents formed by abutting two images
consecutively. This is the simplest and most frequently used image or video
transition.
 Wipe: a replacement of the pixels in a region of the viewport with those
from another image. Wipes can be left-to-right, right-to-left, vertical,
horizontal, swept out like the hands of a clock, etc.
 Dissolve: replaces every pixel with a mixture over time of the two images,
gradually replacing the first by the second. Most dissolves can be classified as
two types: cross dissolve and dither dissolve.
Fade-in and fade-out are special types of cross dissolve. Wipes are special forms of
dither dissolve in which changing pixels follow a particular geometric pattern.

Fundamentals of Multimedia 15
Image Transitions
 Cross Dissolve: every pixel is affected gradually. It can be defined by:-

𝑫 = 𝟏 − 𝜶 𝒕 . 𝐀 + 𝜶 𝒕 .B
where A and B are the color 3-vectors for image A and image B.
Here, 𝜶 𝒕 is a transition function, which is often linear.

 Dither Dissolve: determined by 𝜶 𝒕 , increasingly more and more


pixels in image A will suddenly (instead of gradually as in Cross
Dissolve) change to image B.

Fundamentals of Multimedia 16
Example: Cross Dissolve and Dither Dissolve

Cross Dissolve
𝑫 = 𝟏 − 𝜶 𝒕 . 𝐀 + 𝜶 𝒕 .B
Dither Dissolve from left
A= 150
B= 140 Number of columns = 10
Change = 10 × 0.3= 3 Columns in left
D= (1-0.3)× 𝟏𝟓𝟎 + 𝟎. 𝟑 × 𝟏𝟒𝟎 = 𝟏𝟒𝟕
Replacement from Left 3 columns A
A= 54 By 3 columns from Left 3 columns B
B= 98
D= (1-0.3)× 𝟓𝟒 + 𝟎. 𝟑 × 𝟗𝟖 ≈ 𝟔𝟕
Introduction to Multimedia 17
Image Formats
GIF

Introduction to Multimedia 18
Image Formats
JPEG

Introduction to Multimedia 19
Image Formats
TIFF

Introduction to Multimedia 20
Image Formats
PNG

Introduction to Multimedia 21
System Dependent Format

Introduction to Multimedia 22

You might also like