DIGITAL DATA ACQUISTION
DIGITAL DATA ACQUISTION
& MEDIA BASICS
& MEDIA BASICS
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 1
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 2
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 3
LECTURE SUBTOPICS
LECTURE SUBTOPICS
Issues in Digitizing a Signal Signal Sampling
Quantization Bit Rate
What do you lose in the digitization process? Why do you lose it?
What can you do to avoid (minimize) the loss.
Filtering and Subsampling Acquisition of media and formats Video Progressive and Interlaced
Digital Component Video Formats Aspect ratios
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 4
EXAMPLE SIGNALS
EXAMPLE SIGNALS
Analog Signal Digital Signal
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 5
SAMPLING
SAMPLING
For a signal x(t),
xs (n)=x(nT) where T is the sampling period F=1/T is the sampling frequency.
The inverse transformation is called Interpolation
x(t) from xs (n)
Issues
If the sampled signal is interpolated, how do you
ensure that you get back the original signal How fast should we sample
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 6
QUANTIZATION
QUANTIZATION
The value at every sampled location is digitized. The digital domain has a finite bit representation
The sampled value is approximated to the nearest digital value.
OR Formally –
x q (n)=Q(x s (n)), where Q is a rounding function which maps the values of x s (n) into N levels with a quantization step
Typically, N=2b so that we need b bits to represent one quantized sample.
Issues
What is the correct quantization step? Quantization errors may result!
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 7
QUANTIZATION EXAMPLE IN 1D
QUANTIZATION EXAMPLE IN 1D
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 8
QUANTIZATION EXAMPLE IN 2D (1)
QUANTIZATION EXAMPLE IN 2D (1)
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 9
QUANTIZATION EXAMPLE IN 2D (2)
QUANTIZATION EXAMPLE IN 2D (2)
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 10
QUANTIZATION EXAMPLE IN 2D (3)
QUANTIZATION EXAMPLE IN 2D (3)
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 11
COLOR QUANTIZATION IN IMAGES
COLOR QUANTIZATION IN IMAGES
24 bit RGB Color 16 Colors (8 bits per channel)
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 12
BIT RATE
BIT RATE
How many bits do you get per second?
Bit rate = (number of samples per second) x
(bits per sample)
Bit rate relates to the network through put
Examples of bitrate
Audio – CD Bitrate
Sampling frequency: F= 44.1 KHz Quantization with 16 bits
Bit-rate = 705.6 Kb/s (per channel)
As sampling rate increases, bit rate increases
As quantization bits used increase, bit rate increases
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 13
BIT RATE
BIT RATE
Signal
Sampling Rate
Quantization
Bit Rate
Speech
8 KHz
8 bits per sample
64Kbps
Audio CD
44.1 KHz
16 bits per sample
706 Kbps (mono) 1.4 Mbps (stereo)
Teleconferencing
16 KHz
16 bits per sample
256 Kbps
AM Radio
11 KHz
8 bits per sample
88 Kbps
FM Radio
22 KHz
16 bits per sample
352 Kbps (mono) 704 Kbps (stereo)
NTSC TV image frame
Width – 486 Height – 720
16 bits per sample
5.6 Mbits per frame
HDTV (1080i)
Width – 1920 Height – 1080
12 bits per pixel on average
24.88 Mbits per frame
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 14
SOME THEORY
SOME THEORY
Linear Time Invariant Systems
Can be completely characterized by impulse response
Impulse Response Vs Transfer Function
Time Domain View: The output of the system is the
convolution of the input with the system’s impulse
response
Frequency Domain View: The frequency transform
output of the system is the product of the transfer function and the frequency transform of the input
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 15
TIME DOMAIN VS FREQUENCY DOMAIN
TIME DOMAIN VS FREQUENCY DOMAIN
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 16
WHAT’S THE CORRECT SAMPLING RATE?
WHAT’S THE CORRECT SAMPLING RATE?
If F is too large (T is too small), we obtain too high a bit- rate
If F is too small (T is too large), too much information is lost in the sampling process
We want to capture as much information as necessary to represent the signal correctly
the minimum sampling rate for “correct” sampling depends on the frequency characteristics of the signal
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 17
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 18
NYQUIST’S SAMPLING THEOREM
NYQUIST’S SAMPLING THEOREM
Let x(t) have a maximum frequency F. Then we can “perfectly” interpolate the signal x(t) from its sampled version x s (n)=x(nT) only if the sampling period T is less than 1/(2F)
In other words, the sampling frequency should be at least 2F for a signal whose maximum frequency is F – Otherwise – aliasing
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 19
ALIASING EXAMPLES
ALIASING EXAMPLES
Spatial Aliasing in one dimension
Example of a sinusoidal function in 1D Audio aliasing (single frequency) Audio without aliasing –
and with aliasing
Spatial Aliasing in two dimensions
Example of sinusoid in 2D and moiré lines
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 20
Spatial Aliasing
Temporal Aliasing
Revolving Light Rotating Wheel
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 21
OTHER EXAMPLES
OTHER EXAMPLES
Convolution – http://www.jhu.edu/signals/lecture1/frames.html
Fourier Transform –
http://www.jhu.edu/signals/sampling/index.html
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 22
BANDLIMITED SIGNALS AND FILTERS
BANDLIMITED SIGNALS AND FILTERS
Fourier Transform X(f) of a signal x(t): describes how the “energy” of x(t) distributes among frequencies f
If the highest frequency in X(f) is B, we say x(t) is Band Limited to B
A “filter” is an operator characterized by its frequency response H(f):
y(t) X(f) Y(f)
The Fourier transform of y(t) is Y(f)=H(f)X(f)
Therefore, the band By of y(t) is the band Bh of
the filter
Filters can be low-pass, band-pass or high-pass
h(t)
H(f)
x(t)
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 23
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 24
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 25
EXAMPLES USING FILTERS IN COMPRESSION
EXAMPLES USING FILTERS IN COMPRESSION
Audio Filtering Example
Cut-off frequency of microphone is 100KHz. We should sample at 200KHz. If Quantized at 16 bits per sample -> 3 Mbs!
Our hearing system can only detect frequencies up to ~20KHz.
Prefilter the signal
Use a low-pass filter with cut-off frequency B=20KHz. Then, we sample the signal at 40KHz producing only 640 Kb/s
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 26
SUBSAMPLING (DECIMATION)
SUBSAMPLING (DECIMATION)
Given x (n), subsampling by M means generating a signal y (n) = x (Mn).
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 27
SUBSAMPLING EXAMPLE
SUBSAMPLING EXAMPLE
Example: A continuous signal x(t), band-limited to B=4KHz is sampled without aliasing with F=10 KHz. Suppose now we subsample the resulting signal by 2.
This is equivalent to sampling the original signal with rate F=5KHz (which gives aliasing)
Solution: digital low-pass filter before subsampling.
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 28
STATISTICAL DEFINITIONS
STATISTICAL DEFINITIONS
Mean or Expectation of the signal x (n), for a large sample space M is defined as
x(n)M
The Variance of the signal x(n) is defined as
x
nM
n1
2nM 2
x(n) M
x
n1 x
The power of the quantization error, e2 is the variance
of the signal e(n) = x q (n)-x(n)
The signal-to-quantization noise ratio (measured in dB) SNR = 10 log 10 x2 e2)
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 29
ORIGINAL IMAGE
ORIGINAL IMAGE
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 30
SUBSAMPLED BY 2
SUBSAMPLED BY 2
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 31
SUBSAMPLED BY 4
SUBSAMPLED BY 4
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 32
MEDIA REPRESENTATIONS
MEDIA REPRESENTATIONS
Audio Signals – Time Varying Signals (amp @ t) Images – 2D Signal (color @ x, y)
Video Signals – 3D Signals (color @ x, y, t) Graphics –
– Inherently Digital
– 2D graphics objects – 3D graphical objects
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 33
VIDEO SIGNALS
VIDEO SIGNALS
Video is obtained via raster scanning, which transforms a 3-D color signal (function of x, y and t) into a one- dimensional signal for transmission
Scanning is a sampling operation:
Samples in time: Frames
Samples along y (vertical direction): Lines Samples along x (horizontal direction): Pixels
Scanning is done using two formats Progressive Scanning
Interlaced Scanning
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 34
ANALOG VIDEO
ANALOG VIDEO
History of Television and Analog Video
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 35
PROGRESSIVE SCANNING
PROGRESSIVE SCANNING
Rows are scanned left to right and top to bottom
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 36
INTERLACED SCANNING
INTERLACED SCANNING
Each frame is scanned twice (two fields) First, scan all even lines
then, scan all odd lines
Slow-moving objects can be perceived with high spatial resolution
fast-moving objects can be perceived at high frame rate
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 37
INTERLACED SCANNING EXAMPLE
INTERLACED SCANNING EXAMPLE
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 38
LUMINANCE AND CHROMINANCE
LUMINANCE AND CHROMINANCE
In color video, we have 3 signals: 1 signal of luminance
2 signals of chrominance
The three signals are composed together to form a color
image.
If only the luminance signal is received: grayscale image
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 39
CHROMINANCE SUBSAMPLING SCHEMES
CHROMINANCE SUBSAMPLING SCHEMES
Human visual system is less sensitive to the Chrominance channels than to Luminance channel
We can subsample the chrominance channels without noticeable loss of detail
Color subsampling schemes:
4:2:0 (a.k.a. 4:1:1): 1 sample of each chrominance
channel every 4 samples of luminance
4:2:2: 1 sample of each chrominance channel
every 2 samples of luminance
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 40
4:2:0 SUBSAMPLING SCHEME
4:2:0 SUBSAMPLING SCHEME
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 41
4:2:2 SUBSAMPLING SCHEME
4:2:2 SUBSAMPLING SCHEME
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 42
EQUIVALENT BITS/PIXEL
EQUIVALENT BITS/PIXEL
Assume luminance and the two channels of chrominance are quantized with 8 bits/sample
4:2:0 – For every 4 pixels, we have 4 sample of luminance and 1 sample each of chrominance.
Overall, 4·8+8+8=48 bits per 4 pixels. On average, 48/4=12 bits per pixel.
4:2:2 – For every 2 pixels, we have 2 sample of luminance and 1 sample each of chrominance.
Overall, 2·8+8+8=32 bits per 2 pixels. On average, 32/2=16 bits per pixel.
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 43
IMAGE ASPECT RATIOS
IMAGE ASPECT RATIOS
Image Aspect Ratio: ratio of width to height in the image Typically 4:3 for standard TV
HDTV has 16:9
Cinemascope has 47:20!
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 44
PIXEL ASPECT RATIOS
PIXEL ASPECT RATIOS
Pixel Aspect Ratio: ratio width to height of a pixel, assuming it is a rectangle
Computers have square pixels, ratio = 1 NTSC Wide Screen 16:9, ratio = 1.2
Example:
Image Aspect Ratio = 4:3; N l =486; N p =720; Then Pixel Aspect Ratio = (4/3)(486/720)=0.9
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 45
SEAM CARVING
SEAM CARVING
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 46
STILL IMAGE FORMATS
STILL IMAGE FORMATS
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 47
VIDEO FORMATS
VIDEO FORMATS
Format Name
Lines per Frame
Pixels per Line
Frames per Second
Interlaced?
Sub sampling scheme
Image Aspect Ratio
CIF
288
352
N
4:2:0
4:3
QCIF
144
176
N
4:2:0
4:3
SQCIF
96
128
N
4:2:0
4:3
4CIF
576
704
N
4:2:0
4:3
SIF-525
240
352
30
N
4:2:0
4:3
SIF-625
288
352
25
N
4:2:0
4:3
CCIR 601 NTSC (DV, DVB, DTV)
480
720
29.97
Y
4:2:2
4:3
CCIR 601 PAL/SECAM
576
720
25
Y
4:2:0
4:3
EDTV (576p)
480 / 576
720
29.97
N
4:2:0
4:3 / 16:9
HDTV (720p)
720
1280
29.97
N
4:2:0
16:9
HDTV (1080i)
1080
1920
59.94 (field rate)
Y
4:2:0
16:9
HDTV (1080p)
1080
1920
29.97
N
4:2:0
16:9
Digital Cinema (2K)
1080
2048
24
N
4:4:4
47:20
Digital Cinema (4K)
2160
4096
24
N
4:4:4
47:20
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 48
VIDEO FORMATS – BIT RATE COMPUTATION
VIDEO FORMATS – BIT RATE COMPUTATION
Bit-rate for interlaced HDTV format is calculated as N l =1080 lines per frame,
N p =1920 pixels per line,
N FPS =29.97 frames/second
P = 12 bits per pixels (luminance + chrominance) N l N p N FPS ·12 = 745,749,504 bits/s.
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 49
Representation – vector and raster
Graphical object in 2D/3D
GRAPHICS
GRAPHICS
Dr. Parag Havaldar – CS576 Lecture 2 8/31/2020 Page 50