Digital Image Processing
Chapter 2: Digital Image
Fundamentals
Outline
2.1 Elements of Visual Perception
2.1.1 Structure of human eye
2.1.2 Image Formation in the Eye
2.1.3 Brightness Adaptation and Discrimination
2.2 Light and the Electromagnetic Spectrum
2.3 Image sensing and acquisition
2.4 Image sampling and quantization
2.5 Some basic relationships between pixels
2.6 Linear and nonlinear operations
Digital Image
Digital image = a multidimensional
array of numbers (such as intensity image)
or vectors (such as color image)
Each component in the image 10 10 16 28
9 656 70 37 43
26 56
called pixel associates with 32 99 54 70
96 56 67 78
15 2 60 90 96 67
5 13 22
the pixel value (a single number in 32215 54 47 42
the case of intensity images or a 85 853943 92
1 87
54 65 65 39
vector in the case of color images). 32 65 87 99
Human Eye Structure
Three membranes enclose the eye:
Cornea and sclera, Choroid, Retina
ciliary iris
body diaphragm
Pupil size: 2-8mm
Eye color: melanin (pigment) in iris
Visual Perception: Human Eye (cont.)
1. The lens contains 60-70% water, 6% of fat.
2. The iris diaphragm controls amount of light that enters the eye.
3. Light receptors in the retina
- About 6-7 millions cones for bright light vision called photopic
- Density of cones is about 150,000 elements/mm2.
- Cones involve in color vision.
- Cones are concentrated in fovea about 1.5x1.5 mm2.
- About 75-150 millions rods for dim light vision called scotopic
- Rods are sensitive to low level of light and are not involved
in color vision.
4. Blind spot is the region of emergence of the optic nerve from the eye.
Distribution of Rods and Cones in the Retina
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Image Formation in the Eye
Focal length: 14-17mm Length of tree image2.55mm
For distant objects (>3m), lens exhibits the least refractive power (flattened)
For nearby objects (<1m), lens is most strongly refractive (curved)
Lightness Perception: Objective Quantities
• Luminance is the amount of visible light that comes to the eye
from a surface.
• Illuminance is the amount of light incident on a surface.
• Reflectance (also called albedo) is the proportion of incident
light that is reflected from a surface.
– varies from 0% to 100% where 0% is ideal black and 100% is ideal
white. In practice, typical black paint is about 5% and typical white
paint about 85%.
Lightness Perception: Subjective Quantities
• Lightness is the perceived reflectance of a surface.
It represents the visual system's attempt to extract
reflectance based on the luminances in the scene.
• Brightness is the perceived intensity of light
coming from the image itself, rather than any
property of the portrayed scene. Brightness is
sometimes defined as perceived luminance.
Checker-block Illustration*
Patches p and q have the same
reflectance, but different
luminances.
Patches q and r have different
reflectances and different
luminances; they share the same
illuminance.
90
0.1 Patches p and r happen to have
0.9
0.9 10 the same luminance, because the
0.1 lower reflectance of p is
counterbalanced by its higher
illuminance.
Importance of Visual Context
Lightness Illusion
If we cover the right side of the figure and view the left side,
it appears that the stripes are due to paint (reflectance). If we
cover the left side and view the right, it appears that the
stripes are due to different lighting on the stair steps
(illumination).
Another Lightness Illusion
Range of Relative Brightness Sensation
Human visual system cannot operate
over such a high dynamic range
simultaneously, But accomplish such
large variation by changes in its
overall sensitivity, a phenomenon
called “brightness adaptation”
Simultaneous range is smaller than
total adaptation range
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Scotopic Vision
• Scotopic vision is the monochromatic vision of the eye in
dim light. Since cone cells are nonfunctional in low light,
scotopic vision is produced exclusively through rod cells so
therefore there is no colour perception.
– Scotopic vision occurs at luminance levels of 10-2 to 10-6 cd/m².
• Mesopic vision occurs in intermediate lighting conditions
(luminance level 10-2 to 1 cd/m²) and is effectively a
combination of scotopic and photopic vision.
– This however gives inaccurate visual acuity and colour
discrimination.
• In normal light (luminance level 1 to 106 cd/m²), the vision
of cone cells dominates and is photopic vision.
– There is good visual acuity (VA) and colour discrimination.
Mach Band Effect
Perceived brightness is not a
simple function of intensity.
Intensities of surrounding points
effect perceived brightness at each
point.
In this image, edges between bars
appear brighter on the right side
and darker on the left side.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Brightness Adaptation of Human Eye : Simultaneous Contrast
A region ’s perceived brightness does not depend simply on its
intensity
Simultaneous contrast. All small squares have exactly the same intensity
but they appear progressively darker as background becomes lighter.
Optical illusion
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Visible Spectrum
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Light: the Visible Spectrum
• Visible range: 0.43µm(violet)-0.78µm(red)
• Six bands: violet, blue, green, yellow, orange, red
• The color of an object is determined by the nature of the
light reflected by the object
• Monochromatic light (gray level)
• Three elements measuring chromatic light
– Radiance : total amount of energy that flows from the
light source(Watt)
– Luminance : measure of the amount of energy an
observer perceives from a light source(lumens, lm)
– Brightness : a subjective descriptor of light perception
– Ex) light emitted in far infrared region with large
radiance, but no luminance
Beyond Visible
• Gamma-ray and X-ray: medical and
astronomical applications
• Infrared (thermal imaging): near-infrared
and far-infrared
• Microwave imaging:
• Radio-frequency: MRI and astronomic
applications
Image Sensors
Single sensor
Line sensor
Array sensor
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Fundamentals of Digital Images
Origin
y
Image “After snow storm” f(x,y)
An image: a multidimensional function of spatial coordinates.
Spatial coordinate: (x,y) for 2D case such as photograph,
(x,y,z) for 3D case such as CT scan images
(x,y,t) for movies
The function f may represent intensity (for monochrome images)
or color (for color images) or other associated values.
Digital Images
Digital image: an image that has been discretized both in
Spatial coordinates and associated value.
Consist of 2 sets:(1) a point set and (2) a value set
Can be represented in the form
I = {(x,a(x)): x X, a(x) F}
where X and F are a point set and value set, respectively.
An element of the image, (x,a(x)) is called a pixel where
- x is called the pixel location and
- a(x) is the pixel value at the location x
Conventional Coordinate for Image Representation
Spatial resolution
Bit-depth resolution
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Bit-depth Resolution
Bit-depth Resolution (Con’d)
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 16 28
6 26 37
25 13 22
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 65 70 56 43
32699 67 78
26703756
54 96
15 256013902296 67
3221 54 42
47 39
1 855 85 87
43 92
54
65
32 65
65 87 39 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
Inde Red Green Blue
component component component
x
No.
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
Index value 5 0.2 0.8 0.9
… … … …
Digital Image Acquisition Process
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Image Formation Model
f(x,y)=i(x,y)r(x,y)
0<f(x,y)<∞ Intensity – proportional to energy
radiated by a physical source
0<i(x,y)<∞ illumination
0<r(x,y)<1 reflectance (“intrinsic images”)
Generating a Digital Image
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Image Sampling and Quantization
Image sampling: discretize an image in the spatial domain
Spatial resolution / image resolution: pixel size or number of pixels
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
How to choose the spatial resolution
Spatial resolution = Sampling locations
Original image
Sampled image
Under sampling, we lost some image details!
How to choose the spatial resolution : Nyquist Rate
Original image
Sampled image
1mm
2mm
No detail is lost!
Minimum Nyquist Rate:
Spatial resolution
Period Spatial resolution must be less or equal
(sampling rate) half of the minimum period of the image
or sampling frequency must be greater or
= Sampling locations
Equal twice of the maximum frequency.
Effect of Spatial Resolution
256x256 pixels 128x128 pixels
64x64 pixels 32x32 pixels
Effect of Spatial Resolution
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Effect of Spatial Resolution
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Can we increase spatial resolution by interpolation ?
Down sampling is an irreversible process.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Moire Pattern Effect : Special Case of Sampling
Moire patterns occur when frequencies of two superimposed
periodic patterns are close to each other.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Alias Frequency
It would normally be expected that the input signal was:
If the reconstructed
signal is different to
the original, it is
However, the input could have been:
said to be an alias
Alias Frequency
More examples of aliasing:
One cycle between samples
Two cycles between samples
If fact there is an infinite number of possible alias frequencies:
Aliasing is caused by not taking enough samples of the waveform
per cycle.
Image Quantization
Image quantization:
discretize continuous pixel values into discrete numbers
Color resolution/ color depth/ levels:
- No. of colors or gray levels or
- No. of bits representing each pixel value
- No. of colors or gray levels Nc is given by
Nc = 2 b
where b = no. of bits
Quantization function
Nc-1
Nc-2
Quantization level
2
1
0
Light intensity
Darkest Brightest
Effect of Quantization Levels
256 levels 128 levels
64 levels 32 levels
Effect of Quantization Levels (cont.)
16 levels 8 levels
In this image,
it is easy to see
false contour.
4 levels 2 levels
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.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Isopreference curve
Human vision: Spatial Frequency vs Contrast
Basic Relationship of Pixels
(0,0) x
(x-1,y-1) (x,y-1) (x+1,y-1)
(x-1,y) (x,y) (x+1,y)
y
(x-1,y+1) (x,y+1) (x+1,y+1)
Conventional indexing method
Neighbors of a Pixel
Neighborhood relation is used to tell adjacent pixels. It is
useful for analyzing regions.
4-neighbors of p:
(x,y-1)
(x-1,y) p (x+1,y)
(x−1,y)
(x+1,y)
N4(p) = (x,y−1)
(x,y+1)
(x,y+1)
4-neighborhood relation considers only vertical and
horizontal neighbors.
Note: q N4(p) implies p N4(q)
Neighbors of a Pixel (cont.)
(x-1,y-1) (x,y-1) (x+1,y-1)
8-neighbors of p:
(x−1,y−1)
(x-1,y) p (x+1,y)
(x,y−1)
(x+1,y−1)
(x-1,y+1) (x,y+1) (x+1,y+1) (x−1,y)
N8(p) = (x+1,y)
(x−1,y+1)
(x,y+1)
(x+1,y+1)
8-neighborhood relation considers all neighbor pixels.
Neighbors of a Pixel (cont.)
(x-1,y-1) (x+1,y-1) Diagonal neighbors of p:
p
(x−1,y−1)
(x-1,y+1) (x+1,y+1) (x+1,y−1)
ND(p) = (x−1,y+1)
(x+1,y+1)
Diagonal -neighborhood relation considers only diagonal
neighbor pixels.
Connectivity
• Connectivity is adapted from neighborhood relation.
• Two pixels are connected if
•they are in the same class (i.e. the same color or the same
range of intensity) and
• they are neighbors of one another.
For p and q from the same class
4-connectivity: p and q are 4-connected if q N4(p)
8-connectivity: p and q are 8-connected if q N8(p)
mixed-connectivity (m-connectivity):
p and q are m-connected if q N4(p) or
q ND(p) and N4(p) N4(q) =
Adjacency
A pixel p is adjacent to pixel q is they are connected.
Two image subsets S1 and S2 are adjacent if some pixel
in S1 is adjacent to some pixel in S2
S1
S2
We can define type of adjacency: 4-adjacency, 8-adjacency
or m-adjacency depending on type of connectivity.
multiple (ambiguous) 8-adjacency,
Path
A path from pixel p at (x,y) to pixel q at (s,t) is a sequence
of distinct pixels:
(x0,y0), (x1,y1), (x2,y2),…, (xn,yn)
such that
(x0,y0) = (x,y) and (xn,yn) = (s,t)
and
(xi,yi) is adjacent to (xi-1,yi-1), i = 1,…,n
q
p
We can define type of path: 4-path, 8-path or m-path
depending on type of adjacency.
Path (cont.)
8-path m-path
p p p
q q q
m-path from p to q
8-path from p to q
solves this ambiguity
results in some ambiguity
Distance
• For pixel p, q, and z with coordinates (x,y), (s,t) and (u,v),
• D is a distance function or metric if
D(p,q) 0 (D(p,q) = 0 if and only if p = q)
Euclidean distance
D(p,z) D(p,q) + D(q,z)
(2-norm)
D(p,q) = D(q,p) 2 2 5
Example: Euclidean distance 2 52 2
5 2 1 2 5
D ( p, q) = ( x − s) 2 + ( y − t) 2 2 1 0 1 2
e
5 2 1 2 5
2 2 5 2 52 2
Distance (cont.)
D4-distance (city-block distance) is defined as
D4 ( p, q) = x − s + y − t
2
2 1 2
2 1 0 1 2
2 1 2
2
Pixels with D4(p) = 1 is 4-neighbors of p.
Distance (cont.)
D8-distance (chessboard distance) is defined as
D8 ( p, q) = max( x − s , y − t )
2 2 2 2 2
2 1 1 1 2
2 1 0 1 2
2 1 1 1 2
2 2 2 2 2
Pixels with D8(p) = 1 is 8-neighbors of p.
Block-based Processing
Linear and Nonlinear Operations
H is said to be a linear operator if, for any two
images f and g and any two scalars a and b,