You are on page 1of 156

EC010 706L03

Digital Image Processing


Vipin V
Asst. Professor, ECE
SJCET, Palai
07/16/15

SJCET@2014

Module 1
Introduction to DIP
2D sampling, quantization, resolution, brightness,
contrast
Machband effect
Classification of digital images
Image processing system
Image file format

07/16/15

SJCET@2014

Reference
1.S Jayaraman, S Esakkirajan, Digital image processing TMH.
2.Rafael C Gonzalez, R Woods, Digital image processing
Pearson Education.
3.Anil K Jain, Fundamentals of Digital image processing
Prentice Hall India.
4.Kenneth R Castleman, Digital image processing. Pearson
Education.

07/16/15

SJCET@2014

One picture is
worth more than
ten thousand
words
-Anonymous

07/16/15

SJCET@2014

07/16/15

SJCET@2014

07/16/15

SJCET@2014

07/16/15

SJCET@2014

Why Image Processing ?


Image is better than any other
information form for our human being
to perceive. Vision allows humans to
perceive and understand the world
surrounding us.
Human are primarily visual creatures.
Not all animals depend on their eyes, as
we do, for 99% (some says it is 90%)
or more of the information received
about the world.
Image understanding, image analysis,
and computer vision aim to duplicate
the effect of human vision by
electronically ( = digitally, in the
present
context)
perceiving
and
understanding image(s).
07/16/15

SJCET@2014

Natures Wonders
1

5
2

3
07/16/15

1.Squirrels View
2.Sharks View
3.Dogs View
4. Cats View
5.Turtle View

SJCET@2014

Head of a Mosquito
World through Bees Eye

07/16/15

SJCET@2014

10

First Application of a Digital


Image Processing System

07/16/15

SJCET@2014

11

News paper industry


Transfer of a photograph from London to
Newyork
Bartlane Cable System
1920
Normally it takes weeks but transmitted in 3
hours
5 distinct gray levels
increased to 15 in 1929
07/16/15

SJCET@2014

12

07/16/15

SJCET@2014

13

07/16/15

SJCET@2014

14

07/16/15

SJCET@2014

15

Applications
&
Research Topics

07/16/15

SJCET@2014

16

Document Handling

07/16/15

SJCET@2014

17

Signature Verification

07/16/15

SJCET@2014

18

Biometrics

07/16/15

SJCET@2014

19

Fingerprint Verification /
Identification

07/16/15

SJCET@2014

20

Fingerprint Identification Research at


UNR
Minutiae

Matching

Delaunay Triangulation

07/16/15

SJCET@2014

21

Object Recognition

07/16/15

SJCET@2014

22

Object Recognition Research


reference view 1

reference view 2

novel view recognized

07/16/15

SJCET@2014

23

Indexing into Databases


Shape content

07/16/15

SJCET@2014

24

Indexing into Databases (contd)


Color, texture

07/16/15

SJCET@2014

25

Target Recognition
Department of Defense (Army, Airforce,
Navy)

07/16/15

SJCET@2014

26

Interpretation of Aerial
Photography

Interpretation of aerial photography is a problem domain in both computer vision and registration.

07/16/15

SJCET@2014

27

Autonomous Vehicles
Land, Underwater, Space

07/16/15

SJCET@2014

28

Traffic Monitoring

07/16/15

SJCET@2014

29

Face Detection

07/16/15

SJCET@2014

30

Face Recognition

07/16/15

SJCET@2014

31

Face Detection/Recognition Research


at UNR

07/16/15

SJCET@2014

32

Facial Expression Recognition

07/16/15

SJCET@2014

33

Hand Gesture Recognition


Smart Human-Computer User Interfaces
Sign Language Recognition

07/16/15

SJCET@2014

34

Human Activity Recognition

07/16/15

SJCET@2014

35

Medical Applications

07/16/15

skin cancer

breast cancer

SJCET@2014

36

Inserting Artificial Objects into a Scene

07/16/15

SJCET@2014

37

Morphing

07/16/15

SJCET@2014

38

Companies In this Field In India


Sarnoff Corporation
Kritikal Solutions
National Instruments
GE Laboratories
Ittiam, Bangalore
Interra Systems, Noida
Yahoo India (Multimedia Searching)
nVidia Graphics, Pune (have high requirements)
ADE Bangalore, DRDO
07/16/15

SJCET@2014

39

Human Visual System


The best vision model we have!
Knowledge of how images form in the eye can help
us with processing digital images
We will take just a whirlwind tour of the human
visual system

07/16/15

SJCET@2014

40

Structure Of The Human Eye


The lens focuses light from
objects onto the retina
The retina is covered with
light receptors called
cones (6-7 million) and
rods (75-150 million)
Cones are concentrated
around the fovea and are
very sensitive to colour
Rods are more spread out
and are sensitive to low levels
of illumination
07/16/15

SJCET@2014

41

Structure of the Eye contd.


Layers
Cornea, Schlera
Choroid
Retina

Cells
Rods & Cones
Distribution

Blind Spot
Nerve endings
Fovea
Properties
Lens
Ciliary Body and mussels
Viewing distant and nearby object

Image formation in the eye

07/16/15

SJCET@2014

42

Structure Of The Human Eye

07/16/15

SJCET@2014

43

Distribution of Rods & Cones in the


retina

07/16/15

SJCET@2014

44

Image Formation In The Eye


Muscles within the eye can be used to change the
shape of the lens allowing us focus on objects that
are near or far away
An image is focused onto the retina causing rods
and cones to become excited which ultimately send
signals to the brain

07/16/15

SJCET@2014

45

Brightness Adaptation & Discrimination


The human visual system can perceive
approximately 1010 different light intensity levels
However, at any one time we can only discriminate
between a much smaller number brightness
adaptation
Similarly, the perceived intensity of a region is
related to the light intensities of the regions
surrounding it

07/16/15

SJCET@2014

46

Brightness Adaptation & Discrimination


(cont)

07/16/15

SJCET@2014

An example of Mach bands

47

Machband Effect
An effect where the human brain subconsciously
increases the contrast between two surfaces with
different luminance.
The intensity is uniform over the width of the bar.
However, the visual appearance is that each strip is
darker at its left side than its right side.
The spatial interaction of luminance from an object
and its surrounding creates the Machband effect,
which shows that brightness is not a monotonic
function of luminance.
This was first described by Ernst Mach in 1865.
07/16/15

SJCET@2014

48

Brightness Adaptation & Discrimination


(cont)

An example of simultaneous contrast

07/16/15

SJCET@2014

49

Optical Illusions
Our visual systems
play lots of
interesting tricks on
us

07/16/15

SJCET@2014

50

Optical Illusions

07/16/15

SJCET@2014

51

Optical Illusions
Stare at the cross
in the middle of
the image and
think circles

07/16/15

SJCET@2014

52

Light and The Electromagnetic Spectrum


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.
07/16/15

SJCET@2014

53

Spectrum of visible light

07/16/15

SJCET@2014

54

Light and The Electromagnetic Spectrum


Three basic quantities described the quality of a
chromatic (color) light source:
Radiance: the total amount energy that flow from the
light source (can be measured & its unit is watt.)
Luminance: the amount of energy an observer
perceives from a light source (can be measured & its
unit is lumen.)
Brightness: a subjective descriptor of light perception;
perceived quantity of light emitted (cannot be
measured)
07/16/15

SJCET@2014

55

Light and The Electromagnetic Spectrum


Relationship between frequency ( ) and wavelength ( )

, where c is the speed of light(2.998x108m/sec)


Energy of a photon
E h , where h is Plancks constant

What is an Image?
2D array of pixels
Binary image (bitmap)
Pixels are bits
Grayscale image
Pixels are scalars
Typically 8 bits (0..255)
Color images
Pixels are vectors
Order can vary: RGB, BGR
Sometimes includes Alpha

What is an Image?
2D array of pixels
Binary image (bitmap)
Pixels are bits
Grayscale image
Pixels are scalars
Typically 8 bits (0..255)
Color images
Pixels are vectors
Order can vary: RGB, BGR
Sometimes includes Alpha

What is an Image?
2D array of pixels
Binary image (bitmap)
Pixels are bits
Grayscale image
Pixels are scalars
Typically 8 bits (0..255)
Color images
Pixels are vectors
Order can vary: RGB, BGR
Sometimes includes Alpha

What is an Image?
2D array of pixels
Binary image (bitmap)
Pixels are bits
Grayscale image
Pixels are scalars
Typically 8 bits (0..255)
Color images
Pixels are vectors
Order can vary: RGB, BGR
Sometimes includes Alpha

An image is a 2-dimensional representation of


f(x,y) where x and y represents the spatial
coordinates and the amplitude of f(x,y) at any
point is the graylevel or intensity at that point
of x,y.

07/16/15

SJCET@2014

61

Image Representation
Before we discuss image acquisition recall that a
digital image is composed of M rows and N columns of
pixels
col
each storing a value
Pixel values are most
often grey levels in the
range 0-255(black-white)
We will see later on
that images can easily
be represented as
matrices
f (row, col)
row
07/16/15

SJCET@2014

62

Matrix Representation
183 160 94 153 194 163 132 165
183 153 116 176 187 166 130 169

179
168
171
182
179
170
131
167

177 177 179 177 179 165 131 167


178 178 179 176 182 164 130 171

179 180 180 179 183 169 132 169


179 179 180 182 183 170 129 173

180 179 181 179 181 170 130 169

Divide into
8x8 blocks

H=256

07/16/15

W=256

SJCET@2014

63

Image Sensing
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

Imaging Sensor
07/16/15

Line of Image Sensors

SJCET@2014

Array of Image Sensors

64

Digital Image Formation Model

07/16/15

SJCET@2014

65

Binary images: images having only two possible brightness levels


(black and white)
Gray scale images : black and white images
Color images: can be described mathematically as three gray scale
images
Let f(x,y) be an image function, then

f(x,y) = i(x,y) r(x,y),


where i(x,y): the illumination function
r(x,y): the reflection function
Note: 0 < i(x,y)< and 0 <r(x,y)< 1.
For digital images the minimum gray level is usually 0, but the
maximum depends on number of quantization levels used to digitize
an image. The most common is 256 levels, so that the maximum level
is 255.
07/16/15

SJCET@2014

66

Image Sampling And Quantization


A digital sensor can only measure a limited number of
samples at a discrete set of energy levels
Digitizing the coordinate values : Sampling
Digitizing the amplitude : Quantization

07/16/15

SJCET@2014

67

Image Sampling And Quantization

07/16/15

SJCET@2014

68

Image Sampling And Quantization

07/16/15

SJCET@2014

69

Image Sampling And Quantization


(cont)
Sampling: digitizing the 2-dimensional spatial coordinate
values
Quantization: digitizing the amplitude values (brightness
level)

07/16/15

SJCET@2014

70

Natural Image (pretend)

07/16/15

SJCET@2014

71

Capture: Digital Camera

07/16/15

SJCET@2014

72

Sampling
How many pixels do you capture?
Area the might have
much detail

Is reduced to one pixel


Averaging effect

07/16/15

SJCET@2014

73

Sampling
Each Sample Point is translated into a pixel
Real world image:
Infinite detail

Single Pixel:
Finite detail

07/16/15

SJCET@2014

74

Quality Loss illuminated


Once the digital image is captured.
There is no way to restore the original detail.

07/16/15

SJCET@2014

75

Analog / Real World Images


In the real world, we can perceive almost infinite
detail
By
Moving closer
Using a microscope
Nano-visualization

07/16/15

SJCET@2014

76

Sampling: Number of Pixels


Original

07/16/15

7500 pixels (100 X 75)

SJCET@2014

77

Sampling: Number of Pixels


Original

07/16/15

1900 pixels (50 X 38)

SJCET@2014

78

Sampling: Number of Pixels


Original

07/16/15

300 pixels (20 X 15)

SJCET@2014

79

Quantization: Number of Colors


Original (16.7 million
colors)

07/16/15

2 colors (1-bit)

SJCET@2014

80

Quantization: Number of Colors


Original (16.7 million
colors)

07/16/15

4 colors (2-bit)

SJCET@2014

81

Quantization: Number of Colors


Original (16.7 million
colors)

07/16/15

8 colors (3-bit)

SJCET@2014

82

Quantization: Number of Colors


Original (16.7 million
colors)

07/16/15

16 colors (4-bit)

SJCET@2014

83

Quantization: Number of Colors


Original (16.7 million
colors)

07/16/15

32 colors (5-bit)

SJCET@2014

84

Quantization: Number of Colors


Original (16.7 million
colors)

07/16/15

64 colors (6-bit)

SJCET@2014

85

Quantization: Number of Colors


Original (16.7 million
colors)

07/16/15

256 colors (8-bit)

SJCET@2014

86

Quantization
A natural image is colored in continuous tones
theoretically has an infinite number of colors.
Binary representation restricts the reproduction
colors and shades.
8 bits can only encode 256 different color values
In image capturing, the process of encoding an
infinite number of possible colors into a finite
number list of colors is called quantization.

07/16/15

SJCET@2014

87

Number of bits required for storing an image


b= M x N x K
where K index term in L=2k
L discrete gray levels allowed for each image

If K=1, L=2 i.e the image can have only 2 shades


What happens when K increases?
07/16/15

SJCET@2014

88

Tutorial

Calculate the Number of bits required for


storing an image of 256 x 256 which has 256
graylevel shades

07/16/15

SJCET@2014

89

Grey Levels is always power of 2


2-bit image 4 grey levels
4 bit image 16 grey levels
8-bit image 256 grey levels
256X256 8-bit image = 256*256*8 bits

07/16/15

SJCET@2014

90

Cameraman image of size


512 by 512 pixels (5 by 5
inches), The dynamic range
is [0, 255].
Find the following:
The number of bits
required to represent a pixel
The size of the image in
bits?

07/16/15

77
79
79
97
120
150
156
SJCET@2014
158

66
61
93
65
81
146
145
166

68
61
84
71
82
112
158
147

67
71
64
75
76
83
125
146

98
61
72
75
72
78
107
153

93
78
76
72
77
62
121
149

79
88
95
95
78
91
95
91
129

81
94
94
111
83
85
86
107

07/16/15

SJCET@2014

92

Sampling and reconstruction

07/16/15

SJCET@2014

93

Aliasing
When waveforms of two different frequencies are
sampled at a particular rate, it may so happen that
sampled values from the two waveforms at each time
instances are identical. That is, when digitized, two
different waveforms may show same digital output.
This effect is called aliasing.
Undersampling rate determined by Nyquist limit
(Shannons sampling theorem)

07/16/15

SJCET@2014

94

Sampling Theory
Two issues
What sampling rate suffices to allow a given continuous
signal to be reconstructed from a discrete sample
without loss of information?
What signals can be reconstructed without loss for a
given sampling rate?

07/16/15

SJCET@2014

95

Spectral Analysis
Spatial (time) domain:

Frequency domain:

Any (spatial, time) domain signal (function) can be


written as a sum of periodic functions (Fourier)
07/16/15

SJCET@2014

96

Fourier Transform

07/16/15

SJCET@2014

97

Fourier Transform
Fourier transform:

F (u ) f ( x)e

i 2xu

dx

Inverse Fourier transform:

f ( x) F (u )e

07/16/15

SJCET@2014

i 2xu

du
98

Sampling theorem
A signal can be reconstructed from its samples if the
signal contains no frequencies above the
sampling frequency.
-Claude Shannon
The minimum sampling rate for a bandlimited
signal is called the Nyquist rate
A signal is bandlimited if all frequencies above a
given finite bound have 0 coefficients, i.e. it
contains no frequencies above this bound.
07/16/15

SJCET@2014

99

Impulse-Train Sampling
Use a periodic impulse train multiplied by the
continuous-time signal x(t)

07/16/15

SJCET@2014

100

07/16/15

SJCET@2014

101

Analysis of Sampling

07/16/15

SJCET@2014

102

07/16/15

SJCET@2014

103

Illustration of aliasing when the sampling frequency is too low.


07/16/15

SJCET@2014

104

(Aliasing)
If the function is under-sampled, then ALIASING corrupts the
sampled function.
X (f)

x (t)
t

3000

Aliasing

6000

5000

6000 samples/sec
07/16/15

Under-sampling (<6000)
SJCET@2014

105

Reconstruction of x(t) from sampled signals

07/16/15

SJCET@2014

106

Lowpass filter used for recovery of the input signal.


07/16/15

SJCET@2014

107

Block diagram of sampling and reconstruction using an ideal lowpass


filter.
07/16/15

SJCET@2014

108

Reconstruction of x(t) from sampled signals

07/16/15

SJCET@2014

109

(Aliasing)

07/16/15

SJCET@2014

110

(Aliasing)

07/16/15

SJCET@2014

111

(Aliasing and Moire Pattern)

07/16/15

SJCET@2014

112

Resolution
Think of resolution as image quality
Intensity Resolution
Spatial Resolution

07/16/15

SJCET@2014

113

Spatial resolution
Smallest discernible (recognize) detail in an image
Usually expressed as dots per inch (dpi) or pixels
per inch (ppi)

Along with number of pixels, the spatial


dimension of the image is important!!!
07/16/15

SJCET@2014

114

Spatial resolution

07/16/15

SJCET@2014

115

Spatial resolution

An image of size 10241024 is printed on paper of size 2.75


2.75 inch.
Resolution = 1021/2.75 = 372 pixels/inch (dots per inch, dpi)
07/16/15

SJCET@2014

116

Spatial resolution

07/16/15

SJCET@2014

117

Intensity Resolution
Smallest discernible change in intensity level.

07/16/15

SJCET@2014

118

Intensity Resolution
k=7
L = 128

k=8
L = 256

k=5
L = 32

k=6
L = 64
07/16/15

SJCET@2014

119

Intensity Resolution

k=4
L = 16

k=3
L=8

k=2
L=4

k=1
L=2

07/16/15

SJCET@2014

120

Spatial and Intensity Resolution

Huang Experiment [1965] attempt to quantify experimentally the


effects on image quality produced by varying N and k simultaneously.
07/16/15

SJCET@2014

121

Spatial and Intensity Resolution

Isopreference curves tend to become more


vertical as the detail in the image increase.

As the detail in the image decrease the perceived quality remained the
same in some intervals in which the spatial resolution was increased, but
the number of gray levels actually decreased.
A possible explanation is that a decrease in k tends to increase the apparent
contrast of an image, a visual effect that human often perceive as improved
quality in an image.

07/16/15

SJCET@2014

122

Classification of Digital Images


Digital Images can be classified into two:i)Raster Image
ii)Vector Image

07/16/15

SJCET@2014

123

i) Raster Image

Images are produced using a grid


of small squares known as pixels.
Each pixel is assigned a specific
color value and location.
When editing a raster graphics
(ex. Digital photo), you are
actually editing pixels rather than
objects or shapes (Photoshop)
Pixels can be seen by zooming in
on a digital image (tiny squares).

Notice the pixels


Bitmap enlargement

Image source: http://graphicssoft.about.com/od/aboutgraphics/a/bitmapvector.htm

07/16/15

SJCET@2014

124

Common Raster Formats


GIF
JPEG
BMP
PNG
TIFF

07/16/15

SJCET@2014

125

ii) Vector Image


These types of images are made of lines
and curves defined by mathematical objects
called vectors (geometric characteristics).
Drawing programs such as CorelDraw and
Adobe Illustrator produce vector graphics.

07/16/15

SJCET@2014

126

A vector image can be moved or resized


without losing quality and file sizes are
generally smaller than raster graphics.
Best choice for creating type or logos
where crisp outlines are needed since
clarity is not lost when scaled/resized.
vector file format (.PS, .EPS, or .PDF)
07/16/15

SJCET@2014

127

07/16/15

SJCET@2014

128

Image File Formats


Encoded in form of binary file format for storing &
transmission
Image file consist of two part:
1) File Header
2) Image Data

07/16/15

SJCET@2014

129

Format/Version identification
Image width and Height
Image Type
Image data format
Compression type
Colourmap(if any)
Pixel value

07/16/15

SJCET@2014

Header

Image Data

130

The file types


1) GIF File Format (Graphic
Interchange Format)
GIF creates a table of up to 256 colors from a pool of
16 million.
If the image has fewer than 256 colors, GIF can render
the image exactly.
GIF is "lossless" only for images with 256 colors or
less. For a rich, true color image, GIF may "lose"
99.998% of the colors.
07/16/15

SJCET@2014

131

GIF file format

Repeated
1 to n times

07/16/15

SJCET@2014

132

Bytes#

Screen width
Screen Height
m

cr

Pixel

Background
0

GIF Screen Descriptor

07/16/15

SJCET@2014

133

2) JPG or JPEG
JPEG is a image compression algorithm
JPEG uses lossy compression scheme
JPG is optimized for photographs and similar
continuous tone images that contain many, many
colors.
It can achieve astounding compression ratios even
while maintaining very high image quality.
It stores information as 24 bit color.
The degree of compression of a JPG is adjustable.
07/16/15

SJCET@2014

134

3) PNG ( Portable Network Graphics)


PNG is a lossless storage format.
It looks for patterns in the image that it can use to
compress file size.
The compression is exactly reversible, so the image
is recovered exactly.
It supports true color i.e., 16 million colors where as
GIF support only 256 colors.

07/16/15

SJCET@2014

135

4) TIFF( Tagged Image File Format


TIFF was developed by Aldus corporation in 1980.
TIFF can be lossless.
The details of the image storage algorithm are
included as part of the file.
TIFF is used almost exclusively as a lossless image
storage format that uses no compression at all.
Most graphics programs that use TIFF do not use
compression .
File sizes are quite big.
07/16/15

SJCET@2014

136

5) BMP (MS Bitmap)


BMP is an uncompressed proprietary format
invented by Microsoft.
There is really no reason to ever use this format.

The BMP file header

07/16/15

SJCET@2014

137

6) PSD ( Photoshops Default Format)


PSD is a proprietary format used by Photoshop.
This is the preferred working format to edit images in
the software
This package uses layers to build complex images, and
layer information may be lost in the nonproprietary
formats such as TIFF and JPG.
However, it is best to save the product as a TIFF or JPG,
so it can be viewed in the future when software changes.
It has no compression features.

07/16/15

SJCET@2014

138

The file types - Summary


GIF results in lose of color information.
JPG are the best in terms of compressed files.
PNG compression can be reversed if needed.
TIFF files are generally large.
BMP should be rarely, if ever used.
PSD is exclusive to Photoshop.

07/16/15

SJCET@2014

139

Image Processing System

07/16/15

SJCET@2014

140

Image Processing System


Image Sensors
Physical Device sensitive to energy
Digitizer Convert o/p to digital form

Specialized Image Processing Hardware


ALU - performs parllely on entire images
Very fast compare to usual CPU
Front end subsystem

07/16/15

SJCET@2014

141

Image Processing System


Computer
Any general purpose computer
Off-line Image Processing Tasks

Software
Specialized modules perform special tasks
Minimum code

Mass Storage
Short-term storage
On-line storage
Archival storage
07/16/15

SJCET@2014

142

Image Processing System


Image Display
Color TV monitors

Hardcopy
Laser Print
Film cameras
CDs

Network
Large Bandwidth
07/16/15

SJCET@2014

143

Types of Imaging
Gamma Ray
Imaging
Source is
radioisotope
PET(Positron
Emission
Tomography)
Astronomical
observations

07/16/15

SJCET@2014

144

X-ray Imaging
Medical Diagnostics
X-ray
Angiography
CAT Computerized
Axial Tomography

Industrial Process
Astronomical
Observations

07/16/15

SJCET@2014

145

UV
Fluorescent microscopy
Astronomical
observations

07/16/15

SJCET@2014

146

Visible and Infrared

07/16/15

Remote sensing
Light microscopy
Law enforcement
industry

SJCET@2014

147

07/16/15

SJCET@2014

148

07/16/15

SJCET@2014

149

07/16/15

SJCET@2014

150

Microwaves
Radar

07/16/15

SJCET@2014

151

Radio Waves
MRI

07/16/15

SJCET@2014

152

Other Imaging Models


Acoustic
Electron Microscopy
Imaging
Computer Generated
Images

07/16/15

SJCET@2014

153

Ultrasound Imaging

07/16/15

SJCET@2014

154

Electron Microscopy

07/16/15

SJCET@2014

155

Computer Generated Images

07/16/15

SJCET@2014

156

You might also like