1.DIP Sampling & Quantization
1.DIP Sampling & Quantization
1.DIP Sampling & Quantization
&
QUANTIZATION
M.V. RAGHUNADH
Assistant Professor, Dept. of ECE
NIT, Warangal – 506004.
[email protected]
Introduction to Digital Image Processing
Purpose of image processing
– Processing of image data for storage, display & transmission
– Improvement of pictorial information for Human Perception
– Improvement of pictorial information for Machine Perception
Analog: Digital:
•Image Intensity
•Image Spectral Distribution (‘color’)
•Image Geometry (Position, Angle, Distortion, …)
•Image Resolution (‘sharpness’ or ‘focus’)
ј
і
DIGITAL IMAGES
• Electronic Snapshots of a scene
or scanned texts/
documents/photographs/manus
cripts/artwork
• Digital image is sampled
(mapped) grid of dots/ pixels
• Each pixel is assigned a tonal
value (black, white, shades of
gray or color) represented in a
binary code
• Bits of each pixel are stored in a
sequence in memory
• These bits are then read and Pixel Values: As shown in this
interpreted by the computer to bitonal image, each pixel is
produce an analog version for
display or printing. assigned a tonal value, in this
example 0 for black and 1 for
white.
Sampling
• Sampling represents the image by intensity
measurements at regularly spaced sample intervals.
I(x,y) I(m,n)
(pixels)
x,y m,n
Digital Images As Vectors
• ‘Stack up’ pixel values: VERY LONG vector
– 1 digital image == 1 point in N-dim. Space
– Nearby points == Similar images
– All possible digital images:
a grid of N-D points I00
I(m,n)
I01
I= I02
– Space of all practical …
digital images: I10
• ~8Meg dimensions I11
(2Mpix * RGBA)
I00 I01 I02 I03 I04 I05 m,n I12
• discrete, quantized
…
Sampling as a Grid / Array Formatting
‘Digital’ Images: 2D Grid of Numbers
• NO intrinsic meaning, but widely assumed to represent
Point Samples of a “smoothed” 2D intensity surface
Uniform sampling pattern (but not always)
( weasel - word ! )
x
Digital Images As Vectors
• Sensible element-by-element operations:
– Add, subtract, scale two images:
0.5 + (I1 - I2 ) = out
I1 - I2 = out
SAMPLING
The Samples
Digital images
Pick a sample color from
Sampling each box/cell of grid to record
Wider
Quantization
level
Narrower
Quantization
level
Coding
• Quantized samples could then be represented digitally by a
string of 0’s and 1’s -- 0010 0011 0011 0000 1010 1011
0101
0110
0111
1000
1001
1010
1011
1100
1101
Image Resolution
Ability to recognize small features and locate boundaries requires enough
pixels
Too few grey levels produce visible “ false contouring" artefacts in
smoothly varying regions.
You need
No. of samples Resolution Print Size at least 150 ppi
(pixels per inch)
For printing
0.3 M 640 x 480 3x4 inches
Example:
Magenta - no Green
Yellow - no Blue
K - Black ink
Color Quantization
• Some display hardware stores 8 bits per pixel
• => it can display at most 256 distinct colors at a time
• To display a full-color image, the computer must
choose an appropriate set of representative colors
and map the image into these colors
Mapping
…
The Median Cut Algorithm