Ece VII Image Processing Notes Main
Ece VII Image Processing Notes Main
Smartworld.asia 1
IMAGE PROCESSING
Subject Code : 10EC763 IA Marks : 25
No. of Lecture Hrs/Week : 04 Exam Hours : 03
Total no. of Lecture Hrs. : 52 Exam Marks : 100
PART - A
UNIT - 1
DIGITAL IMAGE FUNDAMENTALS: What is Digital Image Processing.
fundamental Steps in Digital Image Processing, Components of an Image processing
system, elements of Visual Perception. 6 Hours
UNIT - 2
Image Sensing and Acquisition, Image Sampling and Quantization, SomeBasic
Relationships between Pixels, Linear and Nonlinear Operations. 6 Hours
UNIT - 3
IMAGE TRANSFORMS: Two-dimensional orthogonal & unitary transforms,
properties of unitary transforms, two dimensional discrete Fourier transform. 6 Hours
UNIT - 4
Discrete cosine transform, sine transform, Hadamard transform, Haar transform, Slant
transform, KL transform. 6 Hours
PART - B
UNIT - 5
IMAGE ENHANCEMENT: Image Enhancement in Spatial domain, SomeBasic Gray
Level Trans -formations, Histogram Processing, Enhancement Using Arithmetic/Logic
Operations. 6 Hours
UNIT - 6
Basics of Spatial Filtering Image enhancement in the Frequency Domain filters,
Smoothing Frequency Domain filters, Sharpening Frequency Domain filters,
homomorphic filtering. 6 Hours
UNIT - 7
Model of image degradation/restoration process, noise models, Restoration in the
Presence of Noise, Only-Spatial Filtering Periodic Noise Reduction by Frequency
Domain Filtering, Linear Position-Invariant Degradations, inverse filtering, minimum
mean square error (Weiner) Filtering 10 Hours
UNIT - 8
Color Fundamentals. Color Models, Pseudo color Image Processing., processing basics of
full color image processing 6 Hours
TEXT BOOK:
1. “Digital Image Processing”, Rafael C.Gonzalez and Richard E. Woods, Pearson
Education, 2001, 2nd edition.
REFERENCE BOOKS:
1. “Fundamentals of Digital Image Processing”, Anil K. Jain, Pearson Edun, 2001.
2. “Digital Image Processing and Analysis”, B. Chanda and D. Dutta Majumdar, PHI,
2003.
Smartworld.asia 2
INDEX SHEET
SL.NO TOPIC PAGE NO.
I Unit-1: DIGITAL IMAGE FUNDAMENTALS 1-8
1.1 What is Digital Image Processing?
1.2 fundamental Steps in Digital Image Processing,
1.3 Components of an Image processing system
1.4 elements of Visual Percepton
UNIT – 2 : DIGITAL IMAGE
II 9-18
FUNDAMENTALS
2.1 Image Sensing and Acquisition,
2.2 Image Sampling and Quantization,
2.3 SomeBasic Relationships between Pixels,
2.4 Linear and Nonlinear Operations
III UNIT - 3 : IMAGE TRANSFORMS 19-25
3.1 Two-dimensional orthogonal & unitary transforms
3.2 properties of unitary transforms,
two dimensional discrete Fourier
3.3
transform
IV UNIT – 4 : IMAGE TRANSFORMS 26-32
4.1 Discrete cosine transform
4.2 sine transform,
4.3 Hadamard transform
4.4 Haar transform,
4.5 Slant transform,
4.6 KL transform.
V UNIT – 5 : IMAGE ENHANCEMENT 33-41
5.1 Image Enhancement in Spatial domain,
5.2 Some Basic Gray Level Trans -formations
5.3 Histogram Processing, Enhancement
5.4 Using Arithmetic/Logic operations.
VI UNIT-6 IMAGE ENHANCEMENT 42-52
Basics of Spatial Filtering Image enhancement in the
6.2
Frequency Domain
6.3 filters,
6.4 Smoothing Frequency Domain filters,
Sharpening Frequency Domain
6.5
filters
6.6 homomorphic filtering
VII UNIT-7 IMAGE ENHANCEMENT 53-70
7.1 Model ofDownloaded
image degradation
by Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 3
7.4 Restoration in the Presence of Noise,
Only-Spatial Filtering Periodic Noise Reduction by
7.5
Frequency Domain Filtering,
7.6 Linear Position-Invariant Degradations
7.7 inverse filtering
7.8 minimum mean square error (Weiner) Filtering
VIII UNIT-8 IMAGE ENHANCEMENT 71-87
Color Fundamentals.
8.5 Color Models,
8.6 Pseudo color Image Processing
processing basics of full color image processing
Smartworld.asia 4
Unit-1
Introduction
Smartworld.asia 5
Smartworld.asia 6
a digital domain. Color is used also in later chapters as the basis for
extracting features of interest in an image.
Smartworld.asia 7
Smartworld.asia 8
display explicitly at this point, it is important to keep in mind that viewing the
results of image processing can take place at the output of any stage.
Although large-scale image processing systems still are being sold for
massive imaging applications, such as processing of satellite images, the
trend continues toward miniaturizing and blending of general-purpose small
computers with specialized image processing hardware.
The function of each component is discussed in the following
paragraphs, starting with image sensing. With reference to sensing, two
elements are required to acquire digital images. The first is a physical device
that is sensitive to the energy radiated by the object we wish to image. The
second, called a digitizer, is a device for converting the output of the physical
sensing device into digital form. For instance, in a digital video camera, the
sensors produce an electrical output proportional to light intensity. The
digitizer converts these outputs to digital data.
Specialized image processing hardware usually consists of the
digitizer just mentioned, plus hardware that performs other primitive
operations, such as an arithmetic logic unit (ALU), which performs
arithmetic and logical operations in parallel on entire images. One example of
how an ALU is used is in averaging images as quickly as they are digitized,
for the purpose of noise reduction. This type of hardware sometimes is called
a front-end subsystem, and its most
1.5
Smartworld.asia 9
Smartworld.asia 10
Hardcopy devices for recording images include laser printers, film cameras,
heat-sensitive devices, inkjet units, and digital units, such as optical and CD-
ROM disks. Film provides
Downloaded the highest
by Sudheer Yadav possible resolution, but paper is the
([email protected])
lOMoARcPSD|49982872
Smartworld.asia 11
obvious medium of choice for written material. For presentations, images are
displayed on film transparencies or in a digital medium if image projection
equipment is used. The latter approach is gaining acceptance as the standard
for image presentations.
Recommended Questions
Smartworld.asia 12
UNIT – 2
Image Sensing and Acquisition,
Smartworld.asia 13
The output voltage waveform is the response of the sensor(s), and a digital
quantity is obtained from each sensor by digitizing its response. In this
section, we look at the principal modalities for image sensing and generation.
Smartworld.asia 14
The components of a single sensor. Perhaps the most familiar sensor of this
type is the photodiode, which is constructed of silicon materials and whose
output voltage waveform is proportional to light. The use of a filter in front of
a sensor improves selectivity. For example, a green (pass) filter in front of a
light sensor favors light in the green band of the color spectrum. As a
consequence, the sensor output will be stronger for green light than for other
components in the visible spectrum. In order to generate a 2-D image using a
single sensor, there has to be relative displacements in both the x- and y-
directions between the sensor and the area to be imaged. Figure 2.13 shows
an arrangement used in high-precision scanning, where a film negative is
mounted onto a drum whose mechanical rotation provides displacement in
one dimension. The single sensor is mounted on a lead screw that provides
motion in the perpendicular direction. Since mechanical motion can be
controlled with high precision, this method is an inexpensive (but slow) way
to obtain high-resolution images. Other similar mechanical arrangements use
a flat bed, with the sensor moving in two linear directions. These types of
mechanical digitizers sometimes are referred to as microdensitometers.
Smartworld.asia 15
Smartworld.asia 16
Smartworld.asia 17
energy and focus it onto an image plane. If the illumination is light, the front
end of the imaging system is a lens, which projects the viewed scene onto the
lens focal plane. The sensor array, which is coincident with the focal plane,
produces outputs proportional to the integral of the light received at each
sensor. Digital and analog circuitry sweep these outputs and convert them to
a video signal, which is then digitized by another section of the imaging
system.
Smartworld.asia 18
Smartworld.asia 19
Neighbors of a Pixel
A pixel p at coordinates (x, y) has four horizontal and vertical
neighbors whose coordinates are given by
(x+1, y), (x-1, y), (x, y+1), (x, y-1)
This set of pixels, called the 4-neighbors of p, is denoted by N4(p). Each
pixel is a unit distance from (x, y), and some of the neighbors of p lie outside
the digital image if (x, y) is on the border of the image.
The four diagonal neighbors of p have coordinates
(x+1, y+1), (x+1, y-1), (x-1, y+1), (x-1, y-1)
and are denoted by ND(p). These points, together with the 4-neighbors, are
called the 8-neighbors of p, denoted by N8(p). As before, some of the points
in ND(p) and N8(p) fall outside the image if (x, y) is on the border of the
image.
Smartworld.asia 20
gray-level values 0 to 255, set V could be any subset of these 256 values. We
consider three types of adjacency:
(a) 4-adjacency. Two pixels p and q with values from V are 4-adjacent if q is
in the set N4(p).
(b) 8-adjacency. Two pixels p and q with values from V are 8-adjacent if q is
in the set N8(p).2.5
(c) m-adjacency (mixed adjacency).Two pixels p and q with values from V
are m-adjacent if
(i) q is in N4(p), or
(ii) q is in ND(p) and the set has no pixels whose values are from V.
In other words, the result of applying a linear operator to the sum of two
images (that have been multiplied by the constants shown) is identical to
applying the operator to the images individually, multiplying the results by
the appropriate constants, and then adding those results. For example, an
operator whose function is to compute the sum of K images is a linear
operator. An operator that computes the absolute value of the difference of
two images is not.
Linear operations are exceptionally important in image processing because
they are based on a significant body of well-understood theoretical and
practical results. Although nonlinear operations sometimes offer better
performance, they are not always predictable, and for the most part are not
well understood theoretically.
Smartworld.asia 21
Recommended Questions
1. Explain the concept of sampling and quantization of an image.
2. Explain i) false contouring ii) checkboard pattern
3. How image is acquired using a single sensor? Discuss.
4. Explain zooming and shrinking digital images.
5. Define 4-adjacency, 8 – adjacency and m – adjacency.
6. With a suitable diagram, explain how an image is acquired using a circular
sensor strip.
7. Explain the relationships between pixels . and also the image operations on a
pixel basis.
8. Explain linear and nonlinear operations.
Smartworld.asia 22
Unit-3
UNITARY TRANSFORMS
One dimensional signals
where g (u) is the transform (or transformation) of f (x) , and T (u, x) is the so
called
If
1 T
I T T
Smartworld.asia 23
T
f T1 g T1
Smartworld.asia 24
Most unitary transforms pack a large fraction of the energy of the image into
relatively few of the transform coefficients. This means that relatively few of
the transform coefficients have significant values and these are the coefficients
that are close to the origin (small index coefficients).
This property is very useful for compression purposes. (Why?)
1
f ( x, y ) F (u , v)e j 2 ( ux vy)
dudv
(2 ) 2
In general F(u, v ) is a complex-valued function of two real frequency
variables u, v and hence, it can be written as:
F (u, v) R(u, v) jI (u, v)
The amplitude spectrum, phase spectrum and power spectrum, respectively,
are defined as follows.
F (u, v ) R2 (u, v ) I 2 (u, v )
1 I (u , v )
(u , v ) tan
R (u , v )
2
P(u, v ) F(u, v ) R2 (u, v ) I 2 (u, v )
Smartworld.asia 25
j ( xu vy)
F ( u, v ) f ( x, y ) e
x y
1
f ( x, y ) F (u, v )e j ( xu vy )
dudv
(2 ) 2 u v
Discrete space and discrete frequency: The two dimensional Discrete Fourier
Transform (2-D DFT)
1 M 1N 1
j 2 ( ux / M vy / N )
F (u, v) f ( x, y)e
MN x 0 y 0
u 0,, M 1 , v 0,, N 1
u 0 v 0
Smartworld.asia 26
1 N 1N 1
f ( x, y ) F ( u, v )e j 2 ( ux vy )/ N
N u 0v 0
The importance of the phase in 2-D DFT. Image reconstruction from amplitude
or phase only.
j (u , v )
F (u, v) { f ( x, y} F (u, v) e f
It has been observed that a straightforward signal synthesis from the Fourier
transform phase f (u , v ) alone, often captures most of the intelligibility of the
1 j (u , v )
f p ( x, y) 1e f
1
f m ( x, y ) F (u , v) e j 0
Smartworld.asia 27
1 j (u , v )
g1 ( x, y) F (u, v) e g
In this experiment f1 ( x, y ) captures the intelligibility of f ( x, y ) , while
g1 ( x, y) captures the intelligibility of g ( x, y) (Try this exercise in
MATLAB).
This is a transform that is similar to the Fourier transform in the sense that the
new independent variable represents again frequency. The DCT is defined
below.
N 1 (2 x 1)u
C (u ) a(u ) f ( x) cos , u 0,1,, N 1
x 0 2N
with a(u ) a parameter that is defined below.
1/ N u 0
a (u )
2/ N u 1,, N 1
The inverse DCT (IDCT) is defined below.
N 1 (2 x 1)u
f ( x) a(u )C (u ) cos
u 0 2N
Smartworld.asia 28
Recommended Questions
Smartworld.asia 29
UNIT – 4
This transform is slightly different from the transforms you have met so far.
Suppose we have a function f ( x), x 0,, N 1 where N 2 n and its Walsh
transform W (u) .
If we use binary representation for the values of the independent variables x
and u we
need n bits to represent them. Hence, for the binary representation of x and
u we can
Example
N x 0
The array formed by the Walsh kernels is again a symmetric matrix having
orthogonal rows and columns. Therefore, the Walsh transform is and its
n 1
elements are of the form T (u, x) ( 1)bi ( x )bn 1 i (u ) . You can immediately
i 0
Smartworld.asia 30
the first element of the Walsh transform in the mean of the original function
f (x) (the DC value) as it is the case with the Fourier transform.
u 0
1 N 1N 1 n 1
W ( u, v ) f ( x, y ) ( 1) ( bi ( x )bn 1 i ( u ) bi ( y ) bn 1 i ( v ))
or
N x 0 y 0 i 0
n 1
(bi ( x ) bn 1 i (u) bi ( y ) bn 1 i ( v ))
1 N 1N 1
W ( u, v ) f ( x, y )( 1) i 0
N x 0 y 0
Smartworld.asia 31
Definition
In a similar form as the Walsh transform, the 2-D Hadamard transform is defined as
follows.
Forward
1 N 1N 1 n 1
H ( u, v ) f ( x, y ) ( 1) ( bi ( x )bi ( u ) bi ( y ) bi ( v ))
, N 2n or
N x 0 y 0 i 0
n 1
(bi ( x ) bi ( u ) bi ( y ) bi ( v ))
1 N 1N 1
H ( u, v ) f ( x, y )( 1) i 0
N x 0 y 0
Inverse
1 N 1N 1 n 1
f ( x, y ) H ( u, v ) ( 1) ( bi ( x )bi ( u ) bi ( y ) bi ( v ))
etc.
N u 0v 0 i 0
Most of the comments made for Walsh transform are valid here.
The Hadamard transform differs from the Walsh transform only in the order
of basis functions. The order of basis functions of the Hadamard transform
does not allow the fast computation of it by using a straightforward
modification of the FFT. An extended version of the Hadamard transform is
the Ordered Hadamard Transform for which a fast algorithm called Fast
Hadamard Transform (FHT) can be applied.
Smartworld.asia 32
(If you have difficulties with the above concepts consult any elementary
linear algebra book.)
Smartworld.asia 33
Very easily it can be seen that C x is real and symmetric. In that case a set of
n orthonormal (at this point you are familiar with that term) eigenvectors
always exists. Let e i and i , i 1,2,, n , be this set of eigenvectors and
corresponding eigenvalues of C x , arranged in descending order so that
Smartworld.asia 34
1 0
2
Cy
0 n
Lets try to reconstruct any of the original vectors x from its corresponding
y . Because the rows of A are orthonormal vectors (why?), then A 1 AT ,
and any vector x can by recovered from its corresponding vector y by using
the relation
T
x A y mx
Suppose that instead of using all the eigenvectors of C x we form matrix AK
from the K eigenvectors corresponding to the K largest eigenvalues,
yielding a transformation matrix of order K n . The y vectors would then be
K dimensional, and the reconstruction of any of the original vectors would
be approximated by the following relationship
T
x̂ AK y mx
The mean square error between the perfect reconstruction x and the
approximate reconstruction x̂ is given by the expression
n K n
ems j j j .
j 1 j 1 j K 1
The derivation of the KLT for the case of one image realisation assumes that
the two dimensional signal (image) is ergodic. This assumption allows us to
calculate the statistics of the image using only one realisation. Usually we
divide the image into blocks and we apply the KLT in each block. This is
reasonable because the 2-D field is likely to be ergodic within a small block
since the nature of the signal changes within the whole image. Let’s suppose
that f is a vector obtained by lexicographic ordering of the pixels f ( x, y)
Smartworld.asia 35
The mean vector of the random field inside the block is a scalar that is
estimated by the approximate relationship
1 M2
mf f (k )
M2 k 1
and the covariance matrix of the 2-D random field inside the block is C f
where
1 M2
cii f (k ) f (k ) m 2f
M2 k 1
and
1 M2
cij ci j f (k ) f (k i j ) m2f
M2 k 1
After knowing how to calculate the matrix C f , the KLT for the case of a
single realisation is the same as described above.
Despite its favourable theoretical properties, the KLT is not used in practice
for the following reasons.
Its basis functions depend on the covariance matrix of the image, and hence
they have to recomputed and transmitted for every image.
Perfect decorrelation is not possible, since images can rarely be modelled as
realisations of ergodic fields.
There are no fast computational algorithms for its implementation.
Recommended Questions
Smartworld.asia 36
UNIT – 5
Preliminaries
(i) A single pixel ( x, y ) . In this case T is a grey level transformation (or mapping)
function.
(ii) Some neighbourhood of ( x, y ) .
(iii) T may operate to a set of input images instead of a single image.
Example 1
The result of the transformation shown in the figure below is to produce an
image of higher contrast than the original, by darkening the levels below m
and brightening the levels above m in the original image. This technique is
known as contrast stretching.
s T (r )
r
m
Downloaded by Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 37
Example 2
r
m
Frequency domain methods
We are dealing now with image processing methods that are based only on
the intensity of single pixels.
Intensity transformations
Image Negatives
The negative of a digital image is obtained by the transformation function
s T (r) L 1 r shown in the following figure, where L is the number of
grey levels. The idea is that the intensity of the output image decreases as the
Downloaded by Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 38
s T (r )
L 1
L 1 r
Contrast Stretching
contrast images occur often due to poor or non uniform lighting conditions,
or due to nonlinearity, or small dynamic range of the imaging sensor. In the
figure of Example 1 above you have seen a typical contrast stretching
transformation.
Smartworld.asia 39
Question: Think how the histogram of a dark image, a bright image and
an image of very low contrast would like. Plot its form in each case.
(i) 0 s 1 .
(ii) r2 r1 T (r2 ) T (r1 ) , i.e., the function T (r ) is increase ng with r .
0 1
(iii) s T (0) pr ( w)dw 0 and s T (1) p r ( w)dw 1 . Moreover, if the original
0 0
image has intensities only within a certain range [rmin , rmax] then
rmin rmax
s T (rmin ) pr ( w)dw 0 and s T (rmax) pr ( w)dw 1 since
0 0
pr (r ) 0, r rmin and r rmax . Therefore, the new intensity s takes always all
values within the available range [0 1].
Let us assume that the original intensity lies within the values r and r dr
with dr a small quantity. dr can be assumed small enough so as to be able to
consider the function pr (w) constant within the interval [r , r dr ] and equal
to pr (r ) . Therefore,
r dr r dr
Pr [r , r dr ] pr ( w)dw pr (r ) dw pr (r )dr .
r r
Now suppose that s T (r ) and s1 T (r dr ) . The quantity dr can be
assumed small enough so as to be able to consider that s1 s ds with ds
Smartworld.asia 40
Conclusion
From the above analysis it is obvious that the transformation of equation (1)
converts the original image into a new image with uniform probability
density function. This means that in the new image all intensities are present
[look at property (iii) above] and with equal probabilities. The whole range of
intensities from the absolute black to the absolute white are explored and the
new image will definitely have higher contrast compared to the original
image.
Unfortunately, in a real life scenario we must deal with digital images. The
discrete form of histogram equalisation is given by the relation
k nj k
sk T (rk ) 2
pr (rj ), 0 rk 1, k 0,1,, L 1
j 0N j 0
(2) The quantities in equation (2) have been defined in Section 2.2. To see
results of histogram equalisation look at any introductory book on Image
Processing.
The improvement over the original image is quite evident after using the
technique of histogram equalisation. The new histogram is not flat because
of the discrete approximation of the probability density function with the
histogram function. Note, however, that the grey levels of an image that has
Downloaded by Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 41
been subjected to histogram equalisation are spread out and always reach
white. This process increases the dynamic range of grey levels and produces
an increase in image contrast.
necessary to enhance details over small areas. The number of pixels in these
neighbourhood and move the centre of this area from pixel to pixel. At each
finally used to map the grey level of the pixel centred in the neighbourhood.
location and the procedure is repeated. Since only one new row or column of
updating the histogram obtained in the previous location with the new data
introduced at each motion step is possible quite easily. This approach has
obvious advantages over repeatedly computing the histogram over all pixels
Downloaded by Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 42
in the neighbourhood region each time the region is moved one pixel
checkerboard effect.
Histogram specification
Smartworld.asia 43
g ( x, y ) f ( x, y ) n( x, y )
Suppose now that we have L different noisy realisations of the same image
f ( x, y) as gi ( x, y ) f ( x, y ) ni ( x, y ) , i 0,1,, L . Each noise process ni ( x, y )
satisfies the properties (i)-(iii) given above. Moreover, n2i ( x, y ) 2
. We form
the image g ( x, y) by averaging these L noisy images as follows:
1 L 1 L 1 L
g ( x, y) gi ( x, y) ( f ( x, y) ni ( x, y)) f ( x, y) ni ( x, y)
Li 1 Li 1 Li 1
Therefore, the new image is again a noisy realisation of the original image
1 L
f ( x, y) with noise n( x, y) ni ( x, y) .
Li 1
Smartworld.asia 44
2 2
2 1 L 1 L
n( x, y ) E{n 2 ( x, y )} E ni ( x, y ) E ni ( x, y )
Li 1 L2 i 1
1 L
2 1 L L 1 L
2 1 L L
E{( ni ( x , y ) )} E{( ( ni ( x, y )n j ( x, y ))} E{ni ( x, y )} E{ ni ( x, y )n j ( x, y )}
L2 i 1 L2 i 1j 1 L2 i 1 L2 i 1j 1
i j i j
1 L
2 1 2
0
L2 i 1 L
noise is negligible.
Recommended Questions
Smartworld.asia 45
UNIT - 6
Spatial masks
Smartworld.asia 46
To be able to estimate the effects of the above mask with relation to the sign
of the coefficients a, b, c, d , e, f , g, h , we will consider the equivalent one
dimensional mask
Let us suppose that the above mask is applied to a signal x(n) . The output of
this operation will be a signal y(n) as
y (n ) dx (n 1) x (n ) ex (n 1) Y (z ) dz 1 X ( z) X ( z) ezX ( z )
1 Y ( z) 1
Y ( z) ( dz 1 ez ) X ( z ) H ( z) dz 1 ez .
X ( z)
This is the transfer function of a system that produces the above input-output
relationship. In the frequency domain we have
H (e j ) d exp( j ) 1 e exp( j ) .
H (e j ) d 1 e
0
H (e j ) d 1 e
H (e j ) H (e j ) d e 0
0
Smartworld.asia 47
The most popular masks for lowpass filtering are masks with all their
coefficients positive and for highpass filtering, masks where the central pixel
is positive and the surrounding pixels are negative or the other way round.
Uniform filtering
The most popular masks for lowpass filtering are masks with all their
coefficients positive and equal to each other as for example the mask shown
below. Moreover, they sum up to 1 in order to maintain the mean of the
image.
1 1 1
1
9
1 1 1
1 1 1
Gaussian filtering
The two dimensional Gaussian mask has values that attempts to approximate
the continuous function
x2 y2
1 2
G ( x, y ) 2
e
2
In theory, the Gaussian distribution is non-zero everywhere, which would
require an infinitely large convolution kernel, but in practice it is effectively
zero more than about three standard deviations from the mean, and so we can
truncate the kernel at this point. The following shows a suitable integer-
valued convolution kernel that approximates a Gaussian with a of 1.0.
Smartworld.asia 48
1 4 7 4 1
4 16 26 16 4
1
273 7 26 41 26 7
4 16 26 16 4
1 4 7 4 1
Median filtering
The median m of a set of values is the value that possesses the property that
half the values in the set are less than m and half are greater than m . Median
filtering is the operation that replaces each pixel by the median of the grey
level in the neighbourhood of that pixel.
Median filters are non linear filters because for two sequences x(n) and
y (n) median x (n ) y n
( ) median x (n ) median y(n)
Median filters are useful for removing isolated lines or points (pixels) while
preserving spatial resolutions. They perform very well on images containing
binary (salt and pepper) noise but perform poorly when the noise is
Gaussian. Their performance is also poor when the number of noise pixels in
the window is greater than or half the number of pixels in the window (why?)
Isolated
0 0 0 0 0 0
Median filtering
0 1 0 0 0 0
0 0 0 0 0 0
Directional smoothing
Smartworld.asia 49
A high pass filtered image may be computed as the difference between the
original image and a lowpass filtered version of that image as follows:
(Highpass part of image) = (Original) - (Lowpass part of image)
Multiplying the original image by an amplification factor denoted by A ,
yields the so called high boost filter:
0 0 0 -1 -1 -1
1
0 A 0 9
-1 -1 -1
0 0 0 -1 -1 -1
Smartworld.asia 50
-1 -1 -1
1
-1 9A 1 -1
9
-1 -1 -1
The high-boost filtered image looks more like the original with a degree of
edge enhancement, depending on the value of A .
An edge is the boundary between two regions with relatively distinct grey
level properties. The idea underlying most edge detection techniques is the
computation of a local derivative operator. The magnitude of the first
derivative calculated within a neighbourhood around the pixel of interest, can
be used to detect the presence of an edge in an image.
The gradient of an image f ( x, y) at location ( x, y) is a vector that consists of
the partial
derivatives of f ( x, y) as follows.
f ( x, y )
x
f ( x, y )
f ( x, y )
y
Smartworld.asia 51
z1 z2 z3
z4 z5 z6
z7 z8 z9
Roberts operator
Equation (1) can be approximated at point z 5 in a number of ways. The
simplest is to use the difference ( z5 z8 ) in the x direction and ( z5 z6 ) in
the y direction. This approximation is known as the Roberts operator, and is
expressed mathematically as follows.
f z5 z8 z5 z6
f z5 z9 z6 z8
(3) Equations (2), (3) can be implemented by using the following masks. The
original image is convolved with both masks separately and the absolute
values of the two outputs of the convolutions are added.
1 0 1 -1
-1 0 0 0
Roberts operator
1 0 0 1
0 -1 -1 0
Roberts operator
Smartworld.asia 52
Prewitt operator
Another approximation of equation (1) but using now a 3 3 mask is the
following.
f ( z7 z8 z 9 ) ( z1 z2 z3 ) ( z3 z6 z 9 ) ( z1 z4 z7 )
(4)
This approximation is known as the Prewitt operator. Equation (4) can be
implemented by using the following masks. Again, the original image is
convolved with both masks separately and the absolute values of the two
outputs of the convolutions are added.
Sobel operator.
The most popular approximation of equation (1) but using a 3 3 mask is the
following.
f ( z7 2 z8 z9 ) ( z1 2 z2 z3 ) ( z3 2 z6 z9 ) ( z1 2 z4 z7 )
(5)
y
-1 0 1 -1 -1 -1
-1 0 1 0 0 0
-1 0 1 1 1 1
Prewitt operator
x
y
-1 0 1 -1 -2 -1
-2 0 2 0 0 0
-1 0 1 1 2 1
Sobel operator
Downloadedxby Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 53
If we consider the left mask of the Sobel operator, this causes differentiation
along the y
direction. A question that arises is the following: What is the effect caused by
the same
mask along the x direction?
and treat it as a one dimensional mask, we are interested in finding the effects
of that mask. We will therefore, treat this mask as a one dimensional impulse
response h[n] of the form h[n]
1 n 1 2
2 n 0
or h[n]
1 n 1 1
0 otherwise
-1 0 1 n
lowpass filter type of response. Therefore, we can claim that the Sobel
operator has a differentiation effect along one of the two directions and a
smoothing effect along the other direction.
Smartworld.asia 54
3.5
2.5
1.5
0.5
0
0 0.5 1 1.5 2 2.5 3 3.5
1
Y ( z) (z 1 z) X ( z)
Y ( j ) (2 cos 1) X ( j ) H( j ) 2 cos 1
shown in the figure below for [0, ] . This response looks “strange” since it
decreases up to the point 2 cos 1 0 cos 0.5 and then starts
increasing.
2.5
1.5
0.5
0
0 0.5 1 1.5 2 2.5 3 3.5
Based on the above analysis it is stated in the literature that the Sobel
operator have the advantage of providing both a differencing a smoothing
effect while Prewitt does not. However, if you implement both operators you
cannot see any visual difference.
Smartworld.asia 55
Laplacian operator
2 2
2 f ( x, y ) f ( x, y )
f ( x, y )
x2 y2
2
f 4 z5 ( z2 z4 z6 z8 )
Recommended Questions
Smartworld.asia 56
Unit-7
Preliminaries
What is image restoration?
Smartworld.asia 57
Where y(i, j ) is the degraded image, f (i, j ) is the original image and
h(i, j, i , j ) is an operator that represents the degradation process, for example
where is called the gamma of the film, w(i, j ) is the incident light intensity
and r (i, j ) is called the optical density. A film is called positive if it has
negative .
Noise models
Smartworld.asia 58
The light intensity associated with the observed optical density y(i, j ) is
y (i, j ) an1 ( i , j )
I (i, j ) 10 w(i, j )10 w(i, j )n(i, j )
where n(i, j ) ˆ 10 an1 ( i , j )
now appears as multiplicative noise having a log-
normal distribution.
Keep in mind that we are just referring to the most popular image
observation models. In the literature you can find a quite large number
of different image observation models. Image restoration algorithms are
based on the above image formation models.
Smartworld.asia 59
Definition
We again consider the general degradation model
y (i, j ) H f (i, j ) n(i, j )
Smartworld.asia 60
H f (i a, j b) y(i a, j b)
From now on we will deal with linear, space invariant type of degradations.
Motion blur. It occurs when there is relative motion between the object and
the camera during exposure.
1 L L
, if i
h (i ) L 2 2
0, otherwise
Atmospheric turbulence. It is due to random variations in the reflective
index of the medium between the object and the imaging system and it occurs
in the imaging of astronomical objects.
i2 j2
h(i, j ) K exp
2 2
Uniform out of focus blur
1
, if i 2 j 2 R
h (i , j ) R
0, otherwise
Uniform 2-D blur
1 L L
2
, if i, j
h (i , j ) ( L) 2 2
0, otherwise
Smartworld.asia 61
1 2
g ( i , j ) g (i , j )
MN i j
BSNR 10log 10 2
n
Both BSNR and ISNR can only be used for simulation with artificial data.
we have the samples h(0), h(1),, h( B 1) .We form the extended versions of
f (i ) and h(i ) , both of size M A B 1 and periodic with period M . These
f e ( 0)
f e (1)
y Hf n f ,
f e ( M 1)
Smartworld.asia 62
he (0) he ( 1) he ( M 1)
he (1) he (0) he ( M 2)
H
(M M)
he ( M 1) he ( M 2) he (0)
I define w(k ) to be
1
2
exp( j k)
w( k ) M
2
exp[ j ( M 1)k ]
M
It can be seen that
Hw (k ) (k )w(k )
W w(0) w(1) w( M 1)
2 1 2
w(k , i ) exp j ki and w 1 (k , i ) exp j ki
M M M
Downloaded by Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 63
H WDW -1 D W-1HW
where
(0) 0
(1)
D
0 ( M 1)
above and assuming that he (i ) is periodic, we start with a matrix problem and
end up with M scalar problems.
Smartworld.asia 64
H0 HM 1 H1
H1 H0 H2
H
HM 1 HM 2 H0
he ( j,0) he ( j, N 1) he ( j,1)
he ( j,1) he ( j,0) he ( j,2)
Hj
he ( j, N 1) he ( j, N 2) he ( j,0)
u 0,1,, M 1, v 0,1,, N 1
Inverse filtering
Smartworld.asia 65
[
problem can be solved as a set of M N scalar problems as follows
(I) Suppose first that the additive noise n(i, j ) is negligible. A problem arises if
H (u, v ) becomes very small or zero for some point (u, v) or for a whole
region in the (u, v) plane. In that region inverse filtering cannot be applied.
Note that in most real applications H (u, v ) drops off rapidly as a function of
distance from the origin. The solution is that if these points are known they
can be neglected in the computation of F (u, v) .
[
The threshold T is defined by the user. In general, the noise may very well
possess large components at high frequencies (u, v) , while H (u, v ) and
Y (u, v) normally will be dominated by low frequency components.
Smartworld.asia 66
minimize
2 2
J (f ) n(f ) y Hf
subject to
2
Cf
where Cf is a high pass filtered version of the image. The idea behind the
above constraint is that the highpass version of the image contains a
considerably large amount of noise! Algorithms of the above type can be
handled using optimization techniques. Constrained least squares (CLS)
restoration can be formulated by choosing an f to minimize the Lagrangian
2 2
min y Hf Cf
Choice of
Smartworld.asia 67
1
f HT H CTC HT y
with (E / ) 2 . Another problem is then the choice of E 2 and 2
. One
choice
[
could be
1
BSNR
Comments
With larger values of , and thus more regularisation, the restored image
tends to have more ringing. With smaller values of , the restored image
tends to have more amplified noise effects. The variance and bias of the error
image in frequency domain are
2
2
M N H ( u, v )
Var ( ) n
u 0v 0 2 2 2
H (u, v ) C ( u, v )
2 2 4
2
M 1N 1 F ( u, v ) C (u, v )
Bias ( ) n
u 0 v 0 2 2 2
H ( u, v ) C ( u, v )
They refer to a large class of methods that have been investigated extensively
over the last decades. They possess the following advantages.
There is no need to explicitly implement the inverse of an operator. The
restoration process is monitored as it progresses. Termination of the
algorithm may take place before convergence.
The effects of noise can be controlled in each iteration.
The algorithms used can be spatially adaptive.
The problem specifications are very flexible with respect to the type of
degradation. Iterative techniques can be applied in cases of spatially varying
or nonlinear degradations or in cases where the type of degradation is
completely unknown (blind restoration).
Downloaded by Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 68
Smartworld.asia 69
seek for an image which lies in the intersection of the two ellipsoids defined
by
2 2
Qf |y {f | y Hf E 2 } and Qf {f | Cf 2
}
The respective projections P1f and P2f are defined by
1
P1f f λ1 I λ1HTH HT (y Hf )
1
P2f [I λ2 I λ2CTC CTC]f
[
Spatially adaptive iteration
where
2
y Hf W1 ( y Hf) T W1 ( y Hf)
2
Cf W2 (Cf) T W2 (Cf)
W1 ,W2 are diagonal matrices, the choice of which can be justified in various
ways. The entries in both matrices are non-negative values and less than or
equal to unity. In that case
(f ) f M (f , ) (H T W1 H C T W2 C)f H T W1 y
A more specific case is
2 2
M (f , ) y Hf Cf W
Downloaded by Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 70
Robust functionals
(I) Convergence
Smartworld.asia 71
2
fk 1 fk 6
2
10
fk
f (i, j ) y(i, j )
W
fˆ (i, j ) H
n(i, j )
E{(fˆ f )( y E{y}) T } 0
From (i) and (ii) we have that
E{( Wy f )( y E{y}) T } 0 E{( Wy E{f } WE{y} f )( y E{y}) T } 0
E{[ W( y E{y}) (f E{f })]( y E{y}) T } 0
~
If ~
y y E{y} and f f E{f } then
~ T
y f )~
E{( W~ y } 0
~ ~ T
E{W~y~y T } E{f ~
y T } WE{~y~y T } E{f ~
y } WR~y~y R ~f~y
If the original and the degraded image are both zero mean then R ~y~y R yy and
R ~f ~y R fy . In that case we have that WR yy R fy . If we go back to the
degradation model and find the autocorrelation matrix of the degraded image
then we get that
y Hf n yT f THT nT
E{yy T } HR ff HT R nn R yy
Downloaded by Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 72
fˆ R ff H T ( HR ff H T R nn ) 1 y
Computational issues
Smartworld.asia 73
They refer to a class of iterative procedures that successively use the Wiener
filtered signal as an improved prototype to update the covariance estimates of
the original image as follows.
Step 0: Initial estimate of R ff
R ff (0) R yy E{yy T }
Step 1: Construct the i th restoration filter
W(i 1) R ff (i )H T ( HR ff (i )H T R nn ) 1
Recommended Questions
Smartworld.asia 74
UNIT – 8
Color Fundamentals
The characteristics generally used to distinguish one color from another are
brightness, hue, and saturation
brightness: the achromatic notion of intensity.
hue: dominant wavelength in a mixture of light waves, represents dominant
color as perceived by an observer.
saturation: relative purity or the amount of white light mixed with its hue.
Smartworld.asia 75
Smartworld.asia 76
Color Models
Smartworld.asia 77
Smartworld.asia 78
Smartworld.asia 79
Smartworld.asia 80
RGB
The RGB colour model relates very closely to the way we perceive colour
with the r, g and b receptors in our retinas. RGB uses additive colour mixing
and is the basic colour model used in television or any other medium that
projects colour with light. It is the basic colour model used in computers and
for web graphics, but it cannot be used for print production.
The secondary colours of RGB – cyan, magenta, and yellow – are formed by
mixing two of the primary colours (red, green or blue) and excluding the
third colour. Red and green combine to make yellow, green and blue to make
cyan, and blue and red form magenta. The combination of red, green, and
blue in full intensity makes white.
In Photoshop using the “screen” mode for the different layers in an image
will make the intensities mix together according to the additive colour mixing
model. This is analogous to stacking slide images on top of each other and
shining light through them.
Smartworld.asia 81
CMYK The 4-colour CMYK model used in printing lays down overlapping
layers of varying percentages of transparent cyan (C), magenta (M) and
yellow (Y) inks. In addition a layer of black (K) ink can be added. The
CMYK model uses the subtractive colour model.
Gamut The range, or gamut, of human colour perception is quite large. The
two colour spaces discussed here span only a fraction of the colours we can
see. Furthermore the two spaces do not have the same gamut, meaning that
converting from one colour space to the other may cause problems for
colours in the outer regions of the gamuts.
Smartworld.asia 82
The HSI color space is very important and attractive color model for image
processing applications because it represents color s similarly how the human
eye senses colors.
The HSI color model represents every color with three components: hue ( H
), saturation ( S ), intensity ( I ). The below figure illustrates how the HIS
color space represents colors.
The Hue component describes the color itself in the form of an angle between
[0,360] degrees. 0 degree mean red, 120 means green 240 means blue. 60
degrees is yellow, 300 degrees is magenta.
Smartworld.asia 83
The Saturation component signals how much the color is polluted with white
color. The range of the S component is [0,1].
The Intensity range is between [0,1] and 0 means black, 1 means white.
To formula that converts from RGB to HSI or back is more complicated than
with other color models, therefore we will not elaborate on the detailed
specifics involved in this process.
Given the intensities of the three primaries RGB of a color, we can find its
HSV representation using different models. Here we use the RGB plane of
the cube to find the corresponding HSV. The three vertices are represented
Smartworld.asia 84
Smartworld.asia 85
Smartworld.asia 86
If , then .
Determine S:
Smartworld.asia 87
In general
Or
(p inside )
From , we get
and
we have
Smartworld.asia 88
(p inside )
(p inside )
CMYK_CONVERT
The procedure uses the following method to convert from CMYK to RGB:
R = (255 - C) (1 - K/255)
G = (255 - M) (1 - K/255)
B = (255 - Y) (1 - K/255)
Downloaded by Sudheer Yadav ([email protected])
lOMoARcPSD|49982872
Smartworld.asia 89
To convert from RGB to CMYK, the procedure uses the following method:
K = minimum of (R, G, B)
In both cases the CMYK and RGB values are assumed to be in the range 0 to
255.
Note
There is no single method that is used for CMYK/RGB conversion. The
method used by CMYK_CONVERT is the simplest and, depending on
printing inks and screen colors, might not be optimal in all situations.
This routine is written in the IDL language. Its source code can be found in
the file cmyk_convert.pro in the libsubdirectory of the IDL distribution.
Syntax
CMYK_CONVERT, C, M, Y, K, R, G, B [, /TO_CMYK]
Arguments
C, M, Y, K
Smartworld.asia 90
To convert from CMYK to RGB, set these arguments to named variables that
will contain the converted values. To convert from RGB to CMYK (with
the TO_CMYK keyword set), set these arguments to scalars or arrays
containing the RGB values.
Keywords
TO_CMYK
If this keyword is set, the values contained in the RGB arguments are
converted to CMYK. The default is to convert from CMYK to RGB.
Recommended Questions