CSE4227 Digital Image Processing
Lecture 02 – Chapter 2: Digital Image
Fundamentals
Dr. Kazi A Kalpoma
Professor, Department of CSE
Ahsanullah University of Science & Technology (AUST)
Contact: [email protected]
Google Class code: 6znzyyh
CSE | AUST Spring 2023
Today’s Contents
Image Sensing and Acquisition
Sampling and quantization
Image Representation
Spatial and Intensity Resolution
Chapter 2 from R.C. Gonzalez and R.E. Woods, Digital Image Processing
(3rd Edition), Prentice Hall, 2008 [ Section 2.3, 2.4 ]
Image Formation
Digital Camera
Film
The Eye
IMAGE SENSING AND ACQUISITION
Image Acquisition
Three main elements
1. Illumination source
2. Scene
3. Sensor (imaging system)
Image Acquisition
1. Illumination source:
– Can be light energy or
– EM spectrum
– Even less tradition sources like
• Sound, heat
2. Scene:
– Any object: visible or hidden
– Source itself
3. Sensor:
– Should be capable of sensing the energy
Light And The Electromagnetic Spectrum
In 1666 Sir Isaac Newton discovered that sunlight passed
through a prism splits into a continuous spectrum of colors
Light is just a particular part of the electromagnetic
spectrum that can be sensed by the human eye
The electromagnetic spectrum is split up according to the
wavelengths of different forms of energy
A discrete bundle (or quantum) of electromagnetic (or light) energy,
PHOTON is proportional to frequency.
A photon’s life choices
Absorption
Diffusion light source
Reflection
λ
Transparency
Refraction
?
Fluorescence
Subsurface scattering
Phosphorescence
Chapter 2 of Szeliski
Interreflection
A photon’ s life choices
• Absorption
• Diffusion
light source
• Reflection
• Transparency
λ
• Refraction
• Fluorescence
• Subsurface scattering
• Phosphorescence
• Interreflection
A photon’ s life choices
• Absorption
• Diffuse Reflection
light source
• Reflection
• Transparency
λ
• Refraction
• Fluorescence
• Subsurface scattering
• Phosphorescence
• Interreflection
A photon’ s life choices
• Absorption
• Diffusion
light source
• Specular Reflection
• Transparency
λ
• Refraction
• Fluorescence
• Subsurface scattering
• Phosphorescence
• Interreflection
A photon’ s life choices
• Absorption
• Diffusion
light source
• Reflection
• Transparency
λ
• Refraction
• Fluorescence
• Subsurface scattering
• Phosphorescence
• Interreflection
A photon’ s life choices
• Absorption
• Diffusion
light source
• Reflection
• Transparency
λ
• Refraction
• Fluorescence
• Subsurface scattering
• Phosphorescence
• Interreflection
A photon’ s life choices
• Absorption
• Diffusion
light source
• Reflection
• Transparency
λ1
• Refraction
• Fluorescence
λ2
• Subsurface scattering
• Phosphorescence
• Interreflection
A photon’ s life choices
• Absorption
• Diffusion
light source
• Reflection
• Transparency
λ
• Refraction
• Fluorescence
• Subsurface scattering
• Phosphorescence
• Interreflection
A photon’ s life choices
• Absorption
• Diffusion
light source
• Reflection
• Transparency
t=1
• Refraction
• Fluorescence
• Subsurface scattering t=n
• Phosphorescence
• Interreflection
A photon’ s life choices
• Absorption
• Diffusion
light source
• Reflection
• Transparency
λ
• Refraction
• Fluorescence
• Subsurface scattering
• Phosphorescence
• Interreflection
(Specular Interreflection)
Image Sensors
Incoming energy lands on a sensor material responsive to that type
of energy and this generates a voltage
Collections of sensors are arranged to capture images
Charge-Coupled Device (CCD) or
Complementary Metal Oxide Semiconductor (CMOS)
Used for convert a continuous
image into a digital image
Contains an array of light sensors
Converts photon into electric charges
accumulated in each sensor unit
CCD KAF-3200E from Kodak.
(2184 x 1472 pixels,
Pixel size 6.8 microns2)
Image Sensors used to transform illumination energy to
digital images.
3 main sensor arrangements:
1. Single sensor
2. Line sensor
3. Array sensor
Single sensor Array sensor
Line sensor
Sensing element can be a photodiode
Filter absorbs extra energy or acts as pass-band
Image Acquisition using Sensor Array
Images are typically generated by illuminating a scene and
absorbing the energy reflected by the objects in that scene.
Image Digitization
Computers use discrete form of the pictures
The process transforming continuous analog image into
discrete approximated image is called digitization.
Transforming
Analog image Digital image
Process
Two steps:
– Sampling and
– Quantization
Image Sampling And Quantisation
Sampling:
Digitizing coordinates
A process which converts the continuous analog space into a
discrete space
Quantization:
Digitizing amplitudes (gray scale values)
A process of converting a continuous analogue signal into a
digital representation of that signal
Image Sampling
1-Dimensional Sampling
Digitizing the coordinate values
Image Quantization
7
6
5
4
3
2
1
0
Digitizing the amplitude values
Image Sampling And Quantisation
7
6
5
4
3
2
1
0
A 7 7 7 1 2 3 4 4 5 5 5 5 5 4 3 3 2 1 0 0 7 7 7B
Digitization
Digital Image
Remember that a digital image is always only
an approximation of a real world scene
Representation of Digital Image
Matrix Representation
Representation of Digital Image
Representation of Digital Image
Representation of Digital Image
Formally,
• Sampling:
– Dividing (x, y) plane into grid with coordinate (zi, zj),
where,
zi , z j Z
• Quantization:
– Assign gray level value from Z to f(zi, zj)
Spatial Resolution
Spatial resolution: M x N
Number of Rows (M) and Columns (N) can be any integer
Bit size of an image: b M N k
For Square image, bN k 2
An image that is 2048 pixels in width and 1536 pixels in height has a
total of 2048×1536 = 3,145,728 pixels or 3.1 megapixels.
Here, spatial resolution is 3.1-megapixel.
One could refer to it as 2048 by 1536 or a 3.1-megapixel image.
Intensity (Gray) Level Resolution
Intensity level resolution refers to the number of
intensity levels used to represent the image
Intensity (Gray) level resolution: L
Number of gray levels, L, is usually power of 2:
k = Bit depth L2 k
Gray level range = [ 0 – L-1 ]
= [ 0 – 255 ]
Intensity (Gray) Level Resolution
The more intensity levels used, the finer the level
of detail discernable in an image
Intensity level resolution is usually given in terms
of the number of bits used to store each intensity
level
Number of Intensity
Number of Bits Examples
Levels
1 2 0, 1
2 4 00, 01, 10, 11
4 16 0000, 0101, 1111
8 256 00110011, 01010101
16 65,536 1010101010101010
Image Sizes in bits for Different Spatial
and Gray Level Resolutions
The calculation is for square images
N = number of row/column
L = gray level resolution
K= bit required to represent gray levels
Answer the questions:
Q1: Suppose a pixel has 1 bit, how many gray
levels can it represent?
Q2: Suppose a pixel has 2 bit, how many gray
levels can it represent?
Q3: Suppose a pixel has p bit, how many gray
levels can it represent?
Q4: if we want to represent 256 intensities of
grayscale, how many bits do we need?
Q5: What is the Gray Level Resolution and Spatial
Resolution of a 3 bit 5x5 image? What will be the
image size in bits? How many gray levels can be
there in the image? What is bit depth?
Effect of Spatial and Gray Level
Resolutions
14X12 resolution means
samples from 14X12
What happens, if we sample
from 8X8 locations?
Effect of Spatial and Gray Level
Resolutions
14X12 resolution means
samples from 14X12
What happens, if we sample
from 8X8 locations?
Larger cell size
Lower spatial resolution
Lower features spatial accuracy
Lower file size, faster display and faster processing time
Effect of Spatial Resolutions
Sub sampled from 1024X1024 up
to 32X32
unchanged gray level (intensity)
Delete alternate row and column while
sub sampling
Effect of Spatial Resolutions
Resized to 1024 x 1024
From 1024X1024 512X512 256X256
Using column
duplication process
From 128X128 64X64 32X32
Can we increase spatial resolution ?
From 128X128 64X64 32X32
Using nearest
neighbor
Using bilinear
interpolation
From 128X128 64X64 32X32
Down sampling is an irreversible process.
Effect of Gray level Resolutions
unchanged
spatial
resolution
Gray level
256 levels 128 levels changed from
256 to 32
64 levels 32 levels
Effect of Gray level Resolutions
Gray level
changed
from 16 to 2
16 levels 8 levels
In this image,
it is easy to see
false contour.
4 levels 2 levels
Effect of Gray level Resolutions
• unchanged spatial resolution
• Gray level changed from 256
to 32
Ridge-like structure in
the smooth area
Effect of Spatial and Gray Level
Resolutions
• Gray level changed from
16 to 2
• Ridge-like structure
is more prominent
• Reason: insufficient
number of gray
levels used
Resolution: How Much Is Enough?
The big question with resolution is always how
much is enough?
– This all depends on what is in the image and what
you would like to do with it
– Key questions include
• Does the image look aesthetically pleasing?
• Can you see what you need to see within the image?
Resolution: How Much Is Enough?
(cont…)
The picture on the right is fine for counting the
number of cars, but not for reading the number
plate
How to select the suitable size and pixel depth of images
The word “suitable” is subjective: depending on “subject”.
Low detail image Medium detail image High detail image
Lena image Cameraman image
To satisfy human mind
1.For images of the same size, the low detail image may need more pixel depth.
2. As an image size increase, fewer gray levels may be needed.
Digital Image Types : Intensity Image
Intensity image or monochrome image
each pixel corresponds to light intensity
normally represented in gray scale (gray
level).
Gray scale values
10 10 16 28
9 6 26 37
15 25 13 22
32 15 87 39
Digital Image Types : RGB Image
Color image or RGB image:
each pixel contains a vector
representing red, green and
blue components.
RGB components
10 10 16 28
9 656 70 26
56 43
3756 78
32 99 54 96 67
70
15 256013 902296 67
21 54 47 42
32 15 87 39
85 85 43 92
54 65 65 39
32 65 87 99
Image Types : Binary Image
Binary image or black and white image
Each pixel contains one bit :
1 represent white
0 represents black
Binary data
0 0 0 0
0 0 0 0
1 1 1 1
1 1 1 1
Image Types : Index Image
Index image
Each pixel contains index number
pointing to a color in a color table
Color Table
Index Red Green Blue
No. component component component
1 0.1 0.5 0.3
2 1.0 0.0 0.0
1 4 9
6 4 7 3 0.0 1.0 0.0
6 5 2 4 0.5 0.5 0.5
5 0.2 0.8 0.9
Index value … … … …
Image Scaling (Zooming & Shrinking)
• Zooming/up scaling/resizing upward can be
achieved by the following techniques:
Pixel Replication
Interpolation
– Nearest Neighbor Interpolation
– Bilinear Interpolation
– Bicubic Interpolation
3x3 matrix is interpolated to 6x6
matrix
Class Work:
• Interpolate a 2x2 matrix [1, 4, 3, 7] to 4x4
• Interpolate a 3x3 matrix [1,4,3,7,2,3,5,6,0] to 9x9
• Interpolate a 2x2 matrix [1, 2, 3, 4] to 8x8
• Interpolate a 3x3 matrix [1,4,3, 7, 5, 6] to 6x6
https://theailearner.com/2018/12/29/image-processing-bilinear-interpolation/
https://theailearner.com/2018/12/29/i
mage-processing-bicubic-interpolatio
n//