1.dip sampling & quantization
TRANSCRIPT
![Page 1: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/1.jpg)
IMAGE SAMPLING IMAGE SAMPLING
& &
QUANTIZATIONQUANTIZATION
M.V. RAGHUNADHM.V. RAGHUNADHAssistant Professor, Dept. of ECEAssistant Professor, Dept. of ECE
NIT, Warangal – 506004.NIT, Warangal – 506004.
[email protected]@nitw.ernet.in
![Page 2: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/2.jpg)
Introduction to Digital Image Processing Purpose of image processingPurpose 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
Typical application areasTypical application areas
Television DIP: brightness, contrast, hue & noise adjustment
Satellite DIP: Remote sensing, Climate, Geology, Land/Sea resource
Medical DIP: Ultra Sound, MRI/PET/CT Scans, X-Rays
Robot Control: Automatic inspection, Unmanned operations-Autonomous Vehicle (Mars Rover)
Visual Communications: Video-coding/ transmission/ conferencing, Tele-conferencing/shopping
Pattern Recognition: Law Enforcement, Biometric Identification: Fingerprint/face/iris/speech/writing/signature
![Page 3: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/3.jpg)
![Page 4: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/4.jpg)
Acquisition and display
• Image acquisition is the first key step in digital image processing.
• Hardware imaging devices: video cameras with frame grabbers, digital 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
![Page 5: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/5.jpg)
![Page 6: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/6.jpg)
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 “vector-valued” function: (fR, fG, fB)
![Page 7: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/7.jpg)
Images as functions
![Page 8: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/8.jpg)
ANALOG Vs DIGITAL
TWO Ways to Process Information:TWO Ways to Process Information:
Analog:
Gramophone LP Record
Magnetic Tape Record
Conventional Radio
Slide Rule
Digital:
Optical CD ROM Record
Magnetic Memory- RAM&ROM
Web Radio
Digital computer
![Page 9: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/9.jpg)
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.
![Page 10: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/10.jpg)
Image RepresentationAnalog image Sampling Quantization Digital image
2D array of picture elements (pixels)
![Page 11: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/11.jpg)
Digital Image Coordinate Convention
![Page 12: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/12.jpg)
Digital Image Representation
f(x,y) = Reflectance (x,y) * Illumination (x,y)Reflectance in [0,1], illumination in [0,inf]
![Page 13: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/13.jpg)
![Page 14: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/14.jpg)
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 …
![Page 15: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/15.jpg)
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
ј
і
![Page 16: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/16.jpg)
DIGITAL IMAGES• Electronic Snapshots of a scene
or scanned texts/ documents/photographs/manuscripts/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.
![Page 17: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/17.jpg)
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.
![Page 18: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/18.jpg)
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.
![Page 19: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/19.jpg)
Sampling and QuantizationContinuous image Continuous scan line from A to B
Sampling & QuantizationDigital scan line
![Page 20: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/20.jpg)
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(x,y)
x,yx,y
I(m,n)I(m,n)
m,nm,n
(pixels)
![Page 21: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/21.jpg)
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
– Space of all practical digital images:
• ~8Meg dimensions (2Mpix * RGBA)
• discrete, quantized
I(m,n)I(m,n)
m,nm,n
II0000
II0101
II0202
……II1010
II1111
II1212
……
I I = =
II00 00 I I01 01 I I02 02 II03 03 II04 04 II05 05
![Page 22: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/22.jpg)
Sampling as a Grid / ArrayGrid / Array Formatting
![Page 23: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/23.jpg)
‘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)
xx
yy
( weasel - word ! )( weasel - word ! )
![Page 24: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/24.jpg)
Digital Images As Vectors
• Sensible element-by-element operations:– Add, subtract, scale two images:
0.5 + (I1 - I2 ) = out
-- ==II11 II22 outout
![Page 25: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/25.jpg)
![Page 26: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/26.jpg)
SAMPLING
More the samples Better the Approximation/Resemblance
The Samples
![Page 27: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/27.jpg)
Digital images
SamplingPick a sample color from
each box/cell of grid to record
Each sample (cell) is called a pixel - picture element The finest the
sampling -the clearer the image
much finer sampling yet
![Page 28: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/28.jpg)
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.
![Page 29: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/29.jpg)
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
![Page 30: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/30.jpg)
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
![Page 31: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/31.jpg)
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
![Page 32: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/32.jpg)
Quantization• Does not necessarily have to be Uniform or Linear
WiderQuantization level
NarrowerQuantization level
![Page 33: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/33.jpg)
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
010101100111100010011010101111001101
![Page 34: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/34.jpg)
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.
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 panchromatic image
improved sharpness of detail is evident
![Page 35: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/35.jpg)
• 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
![Page 36: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/36.jpg)
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
1 M 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 needat least 150 ppi(pixels per inch)For printing
![Page 37: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/37.jpg)
• 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
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).
Example:
![Page 38: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/38.jpg)
BIT DEPTH is determined by the number of bits used to define each pixel. 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)
– Ex: 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.
![Page 39: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/39.jpg)
• 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.
• File 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 GBFILE 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.
![Page 40: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/40.jpg)
Color ImageColor Image
![Page 41: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/41.jpg)
Color Dots image Red Channel image
Green Channel image
![Page 42: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/42.jpg)
COLOR DIGITAL IMAGES
2D Arrays of pixels of varying color and intensity
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
Additive mixing
Subtractivemixing
Color difference
![Page 43: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/43.jpg)
Color Quantization
This process is called
• 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
![Page 44: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/44.jpg)
Quantization phases• Sample the original image for color
statistics
• Select color map based on those statistics
• Map the colors to their representative in the color map• Redraw the image, quantizing each pixel Algorithm
Mapping…
![Page 45: 1.DIP Sampling & Quantization](https://reader033.vdocument.in/reader033/viewer/2022061316/551e7675497959295b8b4570/html5/thumbnails/45.jpg)
The Median Cut Algorithm
• The concept – to use each of the colors in the color map to represent an equal number of pixels in the original image
• The algorithm repeatedly subdivides color space into smaller and smaller rectangular boxes