Digital image processing
Chapter two
1
Digital image fundamentals
2
Contents
• Basic concept of image
• Digital image acquisition process
• Image sampling and quantization
• Mathematical Operations used in Digital Image
Processing
3
Basic concept of image
4
Digital Image Processing Introduction
• A signal can be one dimensional or two dimensional or
higher dimensional signal.
• One dimensional signal is a signal that is measured over
time. The common example is a voice signal.
• The two dimensional signals are those that are measured
over some other physical quantities.
• The example of two dimensional signal is a digital image.
5
Signal and System Introduction
Signals:
Electrical engineering: the fundamental quantity of
representing some information is called a signal.
Mathematics: a signal is a function that conveys some
information.
A signal could be of any dimension and could be of any
form.
A signal cab be: Analog or Digital.
6
Signal and System Introduction
Analog signals:
It is a continuous signal.
They are difficult to analyze, as they carry a huge number of
values.
They are very much accurate due to a large sample of
values.
Needs infinite memory to store and denoted by sin waves.
Example: Human voices (having independent variables of
space and time)
7
Signal and System Introduction
Digital signals:
They are discontinuous signals.
They are very easy to analyze.
Digital signals are less accurate than analog signals because
they are the discrete samples of an analog signal.
Digital signals are not subject to noise so that they last long
and are easy to interpret.
Digital signals are denoted by square waves.
Example: computer
8
Signal and System Introduction
Difference between analog and digital signals:
Criteria Analog Signal Digital Signal
Analysis Difficult Possible to analyze
Representation Continues Discontinuous
Accuracy More accurate Less accurate
Storage Infinite memory Easily stored
Subject to Noise Yes No
Recording Techniques Original signal is preserved Samples of the signal are taken
and preserved
Examples Human voice, Thermometer Computers, Digital phones
9
Signal and System Introduction
Conversion of analog to digital signals:
There are two main concepts that are involved in the
conversion of analog to digital signal.
Sampling: take samples of a digital signal over x axis.
Sampling is done on an independent variable.
Quantization: is done on dependent variable; it is opposite
to sampling.
Quantization is done on the Y variable.
10
Signal and System Introduction
Sampling is done on the x variable.
11
Signal and System Introduction
Quantization is done on the y variable.
12
Signal and System Introduction
Why do we need to convert an analog signal to digital
signal?
Analog signal need infinite memory to store them;
To process the signal using a digital computer the signal
need to be converted to digital.
13
Applications and Usage
Electromagnetic waves can be thought of as stream of
particles, where each particle is moving with the speed of
light.
Each particle contains a bundle of energy.
This bundle of energy is called a photon.
The electromagnetic spectrum according to the energy of
photon is shown below.
14
Applications and Usage
15
Applications and Usage
In this electromagnetic spectrum, we are only able to see
the visible spectrum.
Visible spectrum mainly includes seven different colors
that are commonly term as VIBGOYR.
VIBGOYR stands for violet , indigo , blue , green , orange
, yellow and Red.
But a camera can see the other things that a naked eye is
unable to see. For example: x rays , gamma rays , e.t.c.
Hence the analysis of all that other ES is done in digital
image processing.
16
Concept of Dimensions
Dimensions define the minimum number of points required to
point a position of any particular object within a space.
Example: longitude, latitude, and altitude.
An image has only height and width. An image does not have
depth.
17
Concept of Dimensions
Different dimensions of signals:
1 dimension signal (Fx = waveform)
2 dimensions signal (Fx, y = Image)
3 dimensions signal (Fx, y, z = animated character)
4 dimensions signal (Fx, y, z, t = animated movie)
18
Image Formation on human eye
When light falls upon the particular object , it is reflected
back after striking through the object.
The rays of light when passed through the lens of eye ,
form a particular angle , and the image is formed on the
retina which is the back side.
The image that is formed on the retina is inverted.
This image is then interpreted by the brain and that makes
us able to understand things.
19
Image Formation on human eye
Image formation in human eye:
20
Image Formation on Camera
In analog cameras , the image formation is due to the chemical
reaction that takes place on the strip that is used for image
formation.
A 35mm film cartridge is used in analog camera.
This film is coated with silver halide a chemical substance.
21
Image Formation on Camera
In the digital camera , a CCD (charge-coupled device)
array of sensors is used for the image formation.
It is an image sensor, and like other sensors it senses the
values and converts them into an electric signal.
This CCD is actually in the shape of array or a
rectangular grid.
It is like a matrix with each cell in the matrix contains a
sensor that senses the intensity of photon.
22
Image Formation on Camera
Each sensor of the CCD array itself is an analog sensor.
When photons of light strike on the chip , it is held as a
small electrical charge in each photo sensor.
The response of each sensor is directly equal to the amount
of light or photon energy striked on the surface of the
sensor.
23
Image Formation on Camera
The value of each sensor of the CCD array refers to each
value of individual pixel.
The number of sensors = number of pixels.
It also means that each sensor could have only one and
only one value.
24
Concept of Pixel
Pixel is the smallest element of an image. Each pixel
correspond to any one value.
In an 8-bit gray scale image, the value of the pixel
between 0 and 255.
The value of a pixel at any point correspond to the
intensity of the light photons striking at that point.
Each pixel store a value proportional to the light intensity
at that particular location.
25
Concept of Pixel
The number of pixels would be equal to the number of
rows multiply with number of columns.
This can be mathematically represented as below:
Total number of pixels = number of rows X number of
columns
Example: a three by three image matrix has:
Total number of pixels = 3 X 3
Pixels = 9
26
Concept of Bits per Pixel
Bpp or bits per pixel denotes the number of bits per pixel.
The number of different colors in an image is depends on
the depth of color or bits per pixel.
27
Concept of Bits per Pixel
Black color: 0 pixel value always denotes black color; but
there is no fixed value that denotes white color.
White color: the value that denotes white color can be
calculated as:
White color = (2)bpp - 1
In case of 1 bpp , 0 denotes black , and 1 denotes white.
In case 8 bpp , 0 denotes black , and 255 denotes white.
28
Concept of Bits per Pixel
Image storage requirements: the size of an image depends
upon three things.
Number of rows;
Number of columns;
Number of bits per pixel.
Size of an image = rows * cols * bpp
Example: a gray scale image of 1024 rows by 1024 cols
Size of an image = 1024 * 1024 * 8 = 8388608
29
Types of Images
There are many type of images:
Binary image: contain only two pixel values 0 and 1.
Monochrome (0 refers to black and 1 to white color)
Black and white image
Gray scale image: it has 256 different shades of colors.
Vary from 0-255 (0 stands for black and 255 stands for white)
127 or 128 stands for gray color.
Color image: true color format
24 bit (Red, Green and Blue each 8 bits)
Three different matrix of R, G, and B.
30
Image sensing and acquisition
31
Image sensing and acquisition…
• Three principal sensor arrangements used to transform illumination
energy in to digital images.
– Single imaging sensor
– Line sensor
– Array sensor
• Incoming energy is transformed into a voltage by a combination
of the input electrical power and sensor material that is
responsive to the type of energy being detected.
• The output voltage waveform is the response of the sensor, and a
digital quantity is obtained by digitizing that response.
32
Three principal sensor arrangement
33
Image Acquisition using a single sensor
• Example of a single sensor is a photodiode.
• Now to obtain a two-dimensional image using a single
sensor, the motion should be in both x and y directions.
– Rotation provides motion in one direction.
– Linear motion provides motion in the perpendicular
direction.
34
Image Acquisition using a line sensor (sensor trips)
• The sensor strip provides imaging in one direction.
• Motion perpendicular to the strip provides imaging in other direction.
• A geometry used more frequently than single sensors consists of an
in-line arrangement of sensors.(fig a)
• This arrangement is used in most flat bed scanners.
• Sensor strips in a ring configuration are used in medical and industrial
imaging to obtain cross-sectional (“slice”) images of 3-D objects.(fig b)
35
Image Acquisition using an array sensor
• Sensors are arranged in the form of a 2-D array.
• This type of arrangement is found in digital cameras.e.g. CCD array
• The response of each sensor is proportional to the integral of the
light energy projected onto the surface of the sensor.
• Advantage: Since sensor array is 2D, a complete image can be
obtained by focusing the energy pattern onto the surface of the array.
36
Image sampling and quantization
37
Image sampling and quantization
38
Image sampling and quantization
• There are numerous ways to acquire images, but our objective in
all is to generate digital images from sensed data.
• The output of most sensors is a continuous voltage
waveform whose amplitude and spatial behavior are related to
the physical phenomenon being sensed.
• To create a digital image, we need to convert the continuous
sensed data into a digital format.
• This requires two processes: sampling and quantization.
39
Image sampling and quantization
Generating a digital image. (a) Continuous image. (b) A scaling line
from A to B in the continuous image, used to illustrate the concepts of
sampling and quantization. (c) sampling and quantization. (d) Digital
scan line. 40
Basic concept in image sampling and quantization
• Figure shows a continuous image f that we want to
convert to digital form.
• An image may be continuous with respect to the x- and
y-coordinates, and also in amplitude.
• Hence in order to create an image which is digital, we
need to covert continuous data into digital form.
• There are two stages in digital image processing:
Sampling (spatial resolution ): related to coordinate
value.
Quantization (gray-level resolution ): related to
intensity value.
• Digitizing co-ordinate values(x,y) is called “sampling”
• Digitizing the amplitude value is called “quantization” 41
Basic concept in image sampling and quantization….
• The one-dimensional function in Figure is a
A scan line from A to
plot of amplitude (intensity level) values of the B in the continuous
image
continuous image along the line segment AB
in previous figure.
• The random variations are due to image noise.
42
Basic concept in image sampling and quantization….
• The sample points are indicated by a
vertical tick marks at the bottom of the
figure.
• Sampling and
• The samples are shown as small white quantization
squares super imposed on the function.
• The set of this discrete location gives the
sample function
• To form a digital function, the intensity
values must be converted (quantized) in to
discrete quantities.
• The right side of the figure shows the
intensity scale divided into eight discrete
interval.
• Ranging from black to white
43
Basic concept in image sampling and quantization….
• The continuous intensity levels are quantized
by assigning one of the eight values to each Digital scan line
sample,
• the assignment is made depending on the
vertical proximity of a sample to a vertical
tick mark.
• The digital samples resulting from both
sampling and quantization are shown as
white squares in Figure. 44
Image sampling and quantization
• first figure shows a continuous image projected on to the plane
of an array sensor.
• Second figure shows the image after sampling and quantization
• The quality of a digital image is determined to a large degree by
the number of samples and discrete intensity levels used in
sampling and quantization.
Continuous image projected on to a sensor array result of image sampling
and quantization 45
Sampling and Quantization
Sampling
46
Sampling and Quantization
Sampling
47
Sampling and Quantization
• Quantization corresponds to a discretization of the
intensity values. That is, of the co-domain of the function.
Quantization, corresponds to a transformation.
Typically, 256 levels (8 bits/pixel) suffices to represent
the intensity. For color images, 256 levels are usually
used for each color intensity.
48
Sampling and Quantization
Quantization
49
Introduction to Mathematical
Operations in DIP
50
Addition of Noisy Images for Noise
Reduction
• In astronomy, imaging under very low light levels
frequently causes sensor noise to render single images
virtually useless for analysis.
• In astronomical observations, similar sensors for noise
reduction by observing the same scene over long periods
of time.
• Image averaging is then used to reduce the noise.
• image averaging is a DIP technique that is often
employed to enhance video images that have been
corrupted by random noise.
• The algorithm operates by computing an average or
arithmetic mean of the intensity values for each pixel
position in a set of captured images from the same scene
or view field 51
Image Averaging
52
An Example of Image Subtraction: Mask
Mode Radiography
• Image subtraction is used routinely for enhancing
differences between images.
• Enhanced detail g(x,y)
g(x,y) = f(x,y) - h(x,y)
Example: Mask mode radiography in medical imaging
• Mask h(x,y): an X-ray image of a region of a patient’s
body.
• Live images f(x,y): X-ray images captured at TV rates
after injection of the contrast medium.
• The procedure gives a movie showing how the contrast
medium propagates through the various arteries in the
area being observed. 53
Image Subtraction
54
Image Multiplication and division for
shading correction
55
Image Multiplication
• Another use of image multiplication is in masking, also
called region of interest (ROI), operations. As Figure below
shows,
• the process consists of multiplying a given image by a mask
image that has 1’s in the ROI and 0’s elsewhere.
• There can be more than one ROI in the mask image, and the
shape of the ROI can be arbitrary.
56
Question & Answer
57