3.
Sampling and Quantization
1. Introduction
A real-world image is:
Continuous in space (x, y coordinates)
Continuous in intensity (brightness values)
To make it suitable for digital processing:
1. Sampling discretizes the spatial coordinates
2. Quantization discretizes the intensity values
Mathematically, a digital image is represented as:
f(x, y) rightarrow f(m, n)
Where (m, n) are discrete pixel locations.
2. Sampling
2.1 Definition
Sampling is the process of converting a continuous image into a set of discrete spatial samples
(pixels).
� It determines how many pixels are used to represent an image.
2.2 Concept of Sampling
The image plane is divided into a grid
Each grid point corresponds to a pixel
Pixel spacing determines the resolution
Example:
Low sampling → fewer pixels → blurred image
High sampling → more pixels → sharp image
2.3 Sampling Rate
The sampling rate specifies how frequently the image is sampled.
� According to the Nyquist Sampling Theorem:
The sampling frequency must be at least twice the highest frequency present in the image to
avoid distortion.
2.4 Effects of Under-Sampling (Aliasing)
If sampling rate is too low:
Fine details are lost
Jagged edges appear
Patterns become distorted
This distortion is called aliasing.
� Example:
Straight lines appear zig-zag
Repetitive textures look incorrect
2.5 Oversampling
Sampling at a very high rate
Improves image quality
Increases memory and computation cost
2.6 Importance of Sampling
Controls spatial resolution
Determines image sharpness
Affects storage and processing time
3. Quantization
3.1 Definition
Quantization is the process of converting continuous intensity values into a finite number of
discrete levels.
� It determines how many gray levels or colors are available in the image.
3.2 Quantization Levels
The number of quantization levels depends on bit depth.
L = 2b
Where:
(L) = number of gray levels
(b) = number of bits per pixel
Examples:
1-bit → 2 levels (black & white)
8-bit → 256 gray levels
16-bit → 65,536 gray levels
3.3 Quantization Process
Continuous intensity range is divided into intervals
Each interval is assigned a discrete value
All values in an interval are mapped to the same level
3.4 Quantization Error
Quantization introduces error, defined as:
{Quantization Error} = {Actual value} -{Quantized value}
Effects:
Loss of fine intensity details
False contouring (banding effect)
3.5 Types of Quantization
(a) Uniform Quantization
Equal step size for all intensity levels
Simple and fast
Commonly used
(b) Non-Uniform Quantization
Step size varies
Better matches human visual perception
Used in image compression
3.6 Importance of Quantization
Controls image smoothness
Affects visual quality
Influences storage size
4. Combined Effect of Sampling and Quantization
Aspect Sampling Quantization
Controls Resolution Gray levels
Affects Sharpness Smoothness
Too low Aliasing Banding
Too high High storage High memory
� Both must be chosen carefully to achieve:
Good visual quality
Efficient storage
Acceptable processing time
5. Practical Examples
Example 1: Sampling Effect
256 × 256 image → low resolution
1024 × 1024 image → high resolution
Example 2: Quantization Effect
4-bit image → 16 gray levels (visible bands)
8-bit image → 256 gray levels (smooth appearance)
6. Applications
Digital cameras
Medical imaging (X-ray, MRI)
Satellite imagery
Computer vision systems
Image compression (JPEG, MPEG)
7. Advantages and Limitations
Advantages
Enables digital storage and processing
Allows image enhancement and analysis
Supports automation
Limitations
Information loss is unavoidable
Poor selection causes visual artifacts