IMAGE SAMPLING & QUANTIZATION
M.V. RAGHUNADH Assistant Professor, Professor, Dept. of o f ECE NIT, Warangal ± ± 506004. 5060 50 6004 04..
[email protected]
Introduction to Digital Image Processing y
Purpose of image processing
± Processing of image data for storage, storage, display & transmission ± Improveme Improvement nt of pictorial pictorial information information for Human Perception ± Improveme Improvement nt of pictorial pictorial information information for Machine Perception Perception y
Typical application areas
Television DIP: DIP: brightness, contrast, contrast, hue & noise adjustment Satellite DIP: DIP: Remote sensing, Climate, Geology, Land/Sea resource Medical DIP: DIP: Ultra Sound, MRI/PET/CT Scans, X-Rays Robot Control: Control: Automatic inspection, Unmanned operationsAutonomous Vehicle (Mars Rover) Visual Communicatio Communications ns:: Video-coding/ transmission/ transmission/ conferencing, Tele-co Tele-conferencing/shopping nferencing/shopping Pattern Recognition: Recognition: Law Enforcement, Biometric
Introduction to Digital Image Processing y
Purpose of image processing
± Processing of image data for storage, storage, display & transmission ± Improveme Improvement nt of pictorial pictorial information information for Human Perception ± Improveme Improvement nt of pictorial pictorial information information for Machine Perception Perception y
Typical application areas
Television DIP: DIP: brightness, contrast, contrast, hue & noise adjustment Satellite DIP: DIP: Remote sensing, Climate, Geology, Land/Sea resource Medical DIP: DIP: Ultra Sound, MRI/PET/CT Scans, X-Rays Robot Control: Control: Automatic inspection, Unmanned operationsAutonomous Vehicle (Mars Rover) Visual Communicatio Communications ns:: Video-coding/ transmission/ transmission/ conferencing, Tele-co Tele-conferencing/shopping nferencing/shopping Pattern Recognition: Recognition: Law Enforcement, Biometric
Acquisition and display Image acquisition is the first key step in digital image processing. Hardware imaging devices: devices: video cameras with frame grabbers, digital cameras, cameras, slide or flat bed scanners Issues: lower noise, greater dynamic range, high resolution, Sensitivity, color fidelity, Speed Acquisition programs: save image in various formats, Plug-in program packages like Photoshop, Fovea Pro
What is an image? We can think of an image as a function, f , from R2 to R: ± f ( x, y ) gives the intensity at position ( x, y ) ± Realistically, we expect the image only to be defined over a rectangle, with a finite range: ± f : [a,b]x[c ,d ]
[0,1]
A color image is just three functions pasted together. We can write this as a ³vectorvalued´ function: (f R, f G, f B)
Images as functions
f(x,y) y x
ANALOG Vs DIGITAL TWO Ways to Process Information:
Digital:
Analog: Gramophone LP Record
Optical CD ROM Record
Magnetic Tape Record
Magnetic Memory- RAM&ROM
Conventional Radio
Web Radio
Slide Rule
Digital computer
Digital Images A natural image is a continuous, 2-dimensional distribution of brightness (or some other physical effect). Conversion of natural images into digital form involves two key processes, jointly referred to as digitisation: ± Sampling ± Quantisation Both operations involve loss of image fidelity i.e. since they are approximation processes.
Image Representation Analog image
Sampling
Quantization Digital image
2D array of picture elements (pixels)
Digital Image Coordinate Convention
Digital Image Representation
f(x,y) = Reflectance (x,y) * Illumination (x,y)
Real
Digital
Image Intensity Image Spectral Distribution (µcolor¶) Image Geometry (Position, Angle, Distortion, «) Image Resolution (µsharpness¶ or µfocus¶)
Real Images: Smooth Continuous Variable Complete Unlimited
« « « « «
Digital Images: Sampled « Discrete « Quantized « Fixed « Limited «
What is a digital image? We usually operate on digital (discrete) images: ± Sample the 2D space on a regular grid ± Quantize each sample (round to nearest integer) If our samples are
(
apart, we can write this as:
f [i , j ] = Quantize{ f (i (, j () }
The image can now be represented as a matrix of integer values
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 interpreted by the computer to produce an analog version for display or printing.
Pixel Values: As shown in this bitonal image, each pixel is 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.
Two important criteria: ± Sampling interval distance between sample points or pixels ± Tessellation the pattern of sampling points
The number of pixels in the image is called the resolution of the image. If the number of pixels is too small, individual pixels can be seen and other undesired effects (e.g aliasing) may be evident.
Discretizing the image -- Tessellation and Quantization There are only three ways to tessellate the plane with a regular polygons: Squares: The most common method. Regular hexagons: a useful method due to less rotational dependence. Equilateral triangles: not commonly used.
Sampling and Quantization Continuous image
Continuous scan line from A to B
Digital scan line
Real vs. Digital Real Image == 2D Light Intensity map: I(x,y) Digital Image == 2D grid of numbers: I(m,n) I(x,y)
I(m,n)
x,y
(pixels)
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 I(m,n) I=
± Space of all practical digital images: ~8Meg dimensions (2Mpix * RGBA) discrete, quantized
I00 I01 I02 I03 I04 I05 m,n
I00 I01 I02 « I10 I11 I12 «
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 ! )
Digital Images As Vectors Sensible element-by-element operations: ± Add, subtract, scale two images: 0.5 + (I1 - I2 ) = out
I1
-
I2
=
out
SAMPLING More the samples
Better the Approximation/Resemblance
Digital images Sampling
The finest the sampling -the clearer the image
Pick a sample color from each box/cell of grid to record
Each sample (cell) is called a pixel - picture element much finer sampling yet
Quantisation Quantisation uses an ADC (Analogue to Digital Converter) to transform brightness values into a range of integer numbers, 0 to M , where M is limited by the ADC and the computer. - m= log2M is the number of bits used to represent the value of each pixel. This determines the number of grey levels. Too few bits results in steps between grey levels being apparent.
Quantization (bit allocation) Example: "rounding to the nearest integer³ Non-uniform (variable bit allocation) ±
Based on the statistics of the source (Laplacian Quantizer)
±
Based on the human visual system (perceptually-tuned quantization)
± Either Rounding or Truncation operation on pixel values
QUANTIZATION A computer can not record the pixel values with infinite precision. Original pixel values are randomly valued Hence the pixel values must be quantized
Quantization
Each sample value is replaced by the nominal value of its quantization level. a sample value a nominal value More quantization levels gives a more accurate representation
Quantization Does not necessarily have to be Uniform or Linear
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
Assign a codeword to each quantized sample
0101 0110 0111 1000 1001 1010 1011 1100 1101
Image Resolution y
Ability to recognize small features and locate boundaries requires enough pixels
y
Too few grey levels produce visible ³ false contouring" artefacts in smoothly varying regions.
A Girl image with 256 and 4 grey levels.
left hand image produced by combining Bands 1 (B), 2 (G) & 3 (R) right hand image produced by intensity channel of this color image mixed with Band 8
improved sharpness of detail is
SPATIAL RESOLUTION is the ability to distinguish fine spatial detail. The spatial sampling frequency is often a good indicator of resolution.
dots-per-inch (dpi) or pixels-per- inch (ppi) are common to express resolution for digital images.
Pixels: Individual pixels can be seen by zooming in an image
The resolution of a digital camera refers to the number of samples (pixels) that the camera takes in
No. of samples Resolution
Print Size
0.3 M
640 x 480
3x4 inches
1M
1152 x 864
5x7 inches
1.2 M
1280 x 960
5x7 inches
2.1 M
1600 x 1200
8x10 inches
3.3 M
2048 x 1536
11x14 inches
You need at least 150 ppi (pixels per inch) For printing
PIXEL DIMENSIONS are horizontal & vertical measurements
Determined by multiplying width & height by the dpi.
A digital camera has pixel dimensions expressed as its resolution (e.g., 2,048 by 3,072)
Calculate the dpi dividing a document's dimension into the corresponding pixel dimension against which it is aligned
Example: An 8" x 10" document that is scanned at 300 dpi has the pixel dimensions of 2,400 pixels (8" x 300 dpi) by 3,000 pixels (10" x 300 dpi).
BIT DEPTH is determined by the number of bits used to define each pixel. y Digital images- black and white, (bitonal), grayscale, or color . Bitonal image is represented by 1 bit pixels, which can represent two tones (typically black and white), using µ0¶ for black and µ1¶ for white Grayscale image is composed of multibit pixels( 2 to 8 bits) ± E x: A 2-bit depth image has four possible representations: 00 - Black, 11-White, 01 - Dark gray and 10 - Light gray. An 8 bit depth image has 256 tones assigned to each pixel. Color image: has a bit depth ranging from 8 to 24. ± 8 bits are often used for Red, 8 for Green, and 8 for Blue. Combinations of those bits are used to represent other colors. Ex: A 24-bit image offers 16.7 million (2 24 ) color values.
Bit Depth: Left to right ± 1-bit bitonal, 8-bit grayscale, and 24-bit color images
DYNAMIC RANGE is the range of tonal difference between the lightest light and darkest dark of an image.
FILE SIZE is calculated by multiplying the surface area of a document (height x width) to be scanned by the bit depth and the dpi 2 . Divide this figure by 8 to get in Bytes.
F ile
size naming convention: in increments of 210 (1,024) or more:
1 Kilobyte (KB)
= 1,024 Bytes
1 Megabyte (MB) = 1,024 KB 1 Gigabyte (GB) = 1,024 MB 1 Terabyte (TB) = 1,024 GB FILE FORMATS: Pixel bits that comprise the image plus a header information on how to read and interpret the file. File formats vary in terms of resolution, bit-depth, color capabilities, and support for compression and metadata
Color Image
Color Dots image
Red Channel image
Green Channel image
COLOR DIGITAL IMAGES 2D Arrays of pixels of varying color and intensity Additive mixing
Subtractive mixing
Color Model: how to specify the color of a pixel (coding!) R,G,B: colors represented by a number triplet, specifying the Red(R), Green(G) and Blue(B) intensities Y, CR, CB: for digital images and videos C,M,Y,K : for printing and arts Cyan - no Red Magenta - no Green Yellow - no Blue K - Black ink
Color difference
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
This process is called
Quantization phases
Sample
Select
the original image for color statistics color map based on those statistics Map the colors to their representative in the color map Redraw the image, quantizing each pixel
Mapping «
Algorithm