Digital image processing
Digital image processing
Development Team
Principal Investigator
Prof. R.K. Kohli
&
Prof. V.K. Garg & Prof. Ashok Dhawan
Co- Principal Investigator
Central University of Punjab, Bathinda
Dr. Puneeta Pandey
Assistant Professor
Paper Coordinator
Centre for Environmental Sciences and Technology
Central University of Punjab, Bathinda
Dr. Sandeep Gupta
Assistant Professor
Content Writer
Institute of Environmental Studies
Kurukshetra University, Kurukshetra
Content Reviewer
Dr. Puneeta Pandey
Central University of Punjab, Bathinda
1
Anchor Institute Central University of Punjab
Module
Digital Image Processing
Name/Title
Module Id EVS/RSGIS-EVS/16
Objectives To understand the basic principle of digital image processing of remotely sensed
data
Digital, Pixel, Image Processing, Digital, Pixel, Image Processing, Digital, Pixel,
Keywords Image Processing, Digital Image, Image Pre-processing, Image enhancement,
Image Transformation, Digital Image Classification, Accuracy Assessment
2. Introduction
“A single portrait is enough to carve the whole story”
As learned in earlier chapter a digital image is like a gray colored two-dimensional matrix made up of
Energy
Source
f(x,y)
Object
Imaging
System
Output Digital
Image
Image
Plane
Value of DN at a pixel = f(x,y)
f(x,y) = Brightness of a pixel
Figure 1. Representation of a 2-D digital image
0<f(x,y)<∞
The development in digital image processing has been evolved since the inception of digital computers
and the two goes in parallel. Digital image processing methods were introduced in early 1920s. In
1921, Bartlane cable picture transmission system was used to transmit digitized newspaper images
over submarine cable lines between London and New York. The images were coded and sent by
telegraph at the transmitter end and decoded into images at the receiver using telegraph printers. The
images were initially coded with 5 gray levels, but this number was increased to 15 in 1929 thereby
enhancing the quality of the reproduced images (BCPTS, 2016).
The availability of digital computers was powerful enough to perform meaningful image processing
tasks appeared in early 1960s. The use of such computers and algorithms for improving the quality of
images of the moon taken by Ranger 7 probe started at Jet Propulsion Laboratory (JPL), NASA USA
in 1964. In JPL, the image processing tasks involved was to correct various types of image distortion
inherent in the on-board television camera (Gonzalez and Woods, 2002). Around 1970, the
photographs captured using photographic imaging techniques were transferred to computers for the
4
Image Sensors
5
Problem
In remote sensing, a digital image acquired through different sensors is represented in the form of a
matrix consisting of pixels arranged in rows and columns. Each pixel has a unique location and are
indexed according to their radiometric resolution, for example, pixels of a 8-bit image is indexed
between 0-255. A subset of a multispectral Landsat 8 image is shown below which is also utilized for
different purposes in later sections.
DN DN DN DN DN DN
X Y X Y
(Band 1) (Band 2) (Band 3) (Band 1) (Band 2) (Band 3)
657060 3367320 84 39 43 657060 3367200 79 71 88
657090 3367320 98 52 71 657090 3367200 64 77 82
657120 3367320 105 74 104 657120 3367200 54 99 93
657150 3367320 121 92 130 657150 3367200 128 63 94
657180 3367320 111 128 160 657180 3367200 203 59 123
657210 3367320 91 110 126 657210 3367200 185 59 114
657240 3367320 109 51 66 657240 3367200 133 49 82
657270 3367320 109 42 64 657270 3367200 154 40 71
657300 3367320 115 45 75 657300 3367200 179 31 77
657330 3367320 97 49 69 657330 3367200 125 122 133
657060 3367290 80 40 39 657060 3367170 76 55 59
657090 3367290 95 70 92 657090 3367170 100 37 49
657120 3367290 111 77 109 657120 3367170 129 21 42
657150 3367290 125 82 125 657150 3367170 145 15 49
657180 3367290 130 97 134 657180 3367170 146 24 48
657210 3367290 123 100 119 657210 3367170 126 46 70
657240 3367290 115 82 94 657240 3367170 123 57 82
657270 3367290 107 73 89 657270 3367170 200 36 90
657300 3367290 112 50 70 657300 3367170 255 12 81
657330 3367290 93 38 56 657330 3367170 114 24 52
657060 3367260 98 53 76 657060 3367140 55 52 40
657090 3367260 102 74 102 657090 3367140 80 34 29
657120 3367260 115 83 117 657120 3367140 121 3 1
657150 3367260 145 72 116 657150 3367140 132 6 17
657180 3367260 166 62 116 657180 3367140 121 33 58
657210 3367260 145 73 110 657210 3367140 85 61 63
657240 3367260 123 56 82 657240 3367140 125 89 118
657270 3367260 108 122 132 657270 3367140 164 78 126
657300 3367260 114 121 137 657300 3367140 169 71 106
657330 3367260 94 97 102 657330 3367140 86 59 67
657060 3367230 95 59 83 657060 3367110 0 80 43
657090 3367230 84 78 94 657090 3367110 17 66 31
657120 3367230 59 114 119 657120 3367110 114 0 0
657150 3367230 103 105 124 657150 3367110 115 9 16
657180 3367230 194 60 114 657180 3367110 103 30 59
657210 3367230 173 77 124 657210 3367110 68 46 33
657240 3367230 132 45 75 657240 3367110 134 111 142 9
657270 3367230 117 80 99 657270 3367110 158 88 131
657300 3367230 101 163 183 657300 3367110 153 44 55
657330 3367230 106 255 255 657330 3367110 101 88 94
Remote Sensing & GIS Applications in Environmental Sciences
Environmental
Sciences Digital Image Processing
The digital image processing is a big domain. The tools and technology for data acquisition is different
for different applications. Here, in the forthcoming sections we will be describing only major
processing stages of digital images that are commonly used in the field of remote sensing.
4. Image Acquisition
The reflected energy acquisition from the Earth's surface is measured by imaging sensors that has a
capability to digitize the signal collected by the sensor in its Video and Digital camera. The sensors are
mounted on an aircraft or spacecraft platforms. In earlier days, the conventional camera and analog-
to-digital converters were there to acquire an image. A digital image can be also be produced from
papers using either a CCD camera or a scanner. It is important to mention here that in remote sensing
an imaging system is a complex system where reflection or scattering of energy from the Earth's
surface, followed by transmission through the atmosphere to sensors, and the data transmission from
sensor to ground station on the Earth's surface where after an initial pre-processing such as volts to DN
conversion, removing of noises, resampling and others, the data is ready in an image format to be
utilized for different purposes such as land use/land cover study, disaster monitoring, environmental
pollution study etc. It is well known that the data are recorded in optical as well as microwave spectral
regions through both active and passive sensing and hence are delivered in to distributed spectral
bands (visible, near infra-red, short wave infra-red, microwave) at certain spatial and radiometric
resolution. Generally, the digital images are of four kind: a) Binary, b) Grayscale [0 to 255; black to
white], c) True color or RGB [ 0 to 255 ] (such as 24-bit color images), and d) Indexed. Further, data
acquired and delivered in raster and vector format with additional information in a metadata form.
The digital images obtained from multispectral sensors are arranged in different spectral bands and are
represented in a matrix form (figure 4).
f(x,y)
Pixels
1
Scan Bands
2
Lines
3
Features Elements
10
The digital data are for storing purpose are organized in the following three formats. An image, for
example, consisting of three bands of same resolution can be visualized as three superimposed images
with corresponding pixels in one band registering exactly to those in the other bands. The data formats
are:
5. Image Pre-processing
Image Pre-processing is a process to enhance the image in order to make it suitable for further
processing. It includes mainly radiometric and geometric corrections.
11
12
15
6. Image Enhancement
The purpose of image enhancement is to prepare the image more interpretable for a particular
application and/or feature extraction. The image enhancement techniques can be classified in many
ways. In contrast enhancement or global enhancement, the raw data is transformed by using the
statistics computed over the entire image. The examples of contrast enhancement techniques are linear
contrast stretch, histogram equalized stretch and piece-wise contrast stretch. On the other hand, spatial
or local enhancement considers the local conditions only and these can vary considerably over an
image. The examples of spatial enhancement techniques are image smoothing and sharpening filters.
16
17
(3)
and in the section 4.2.1, the value of 0.11 with 0.055 as below
4.2.1 Low-Pass or Low-Frequency Filter
For example, by applying averaging filter for the kernel pixels given in table 3, we get the gain as
0.055.
(i.e. the value 0.11 is replaced with 0.055).
18
To minimize the high degree of blurring in the image, it is important that a larger pixel value be
assigned to the centre pixel. For example, if we replace the centre pixel value (2) with 4 by
multiplying it with two, then the gain for the resulting kernel would be 0.05.
6.2.2 High-Pass or High-Frequency Filter
A simple high pass filter works by subtracting a low pass filtered image (pixels by pixel) from the
unprocessed original image. The high-pass filters block the low spatial frequency details, thereby
allowing to appear only those pixels where there are large or more tonal variation over a few pixels
distance only, i.e. pixels having high spatial frequencies, thereby emphasizing edges. In this way, the
high-frequency filter evaluates a particular input pixel brightness value and its adjacent pixels, and
outputs a new brightness value which is the mean of this convolution. Often, the difference between
the centre pixel value and its neighbouring pixel values results in edge detection. Thus, high centre
pixel value than its corresponding neighbours is more suitable for the result. Alternatively, the edging
result can also be enhanced by converting the neighbourng pixel values to negative (table 4). The gain
for the resulting kernel would be 0.25. The output high-pass filtered image can be used as an aid
(another band) during the classification of images. Some of the known high-pass filters are Laplacian
edge enhancement filter, Sobel edge detection filters etc.
Table 4. Kernel filter pixel values for edge enhancement
-2 -2 -2
-2 20 -2
-2 -2 -2
a1 a2 a3
19
1 0 -1 1 2 1
2 0 -2 0 0 0
1 0 -1 -1 -2 -1
(5)
7. Image Transformation
Essentially, image transformation involves the generation of a 'new image' from two or more sources.
The source could be a single image involving two or more spectral bands. The resulting image could
be produced after using multitemporal-multispectral image data of the same area. The operation may
involve simple arithmetic operations to a more complex statistical calculations.
20
(6)
where, ORV = output ratio value for the pixel at row i and column j; DNi,j,a and DNi,j,b = pixel
(reflectance) value at the same location in band a and band b, respectively.
Normalized Difference Vegetation Index
Different features on the earth's surface has different spectral reflectance behavior and this concept is
well utilized in the case of Normalized Difference Vegetation Index (NDVI). NDVI is an example of
more complex band ratioing concept where sums of and differences between two spectral bands is
used in the form of an index. As stated above, in this NIR and R bands are being used as two distinct
spectral region for monitoring vegetation health. Apart from NDVI, there are other two simple indices.
These indices are given below in equation form:
(7)
(8)
(9)
It is to be noted here that the computations in the above three equations are being done in each
corresponding pixels for against their values (DNs). Here, in case of NDVI, the difference is basically
'normalized' by dividing by the sum of the two DN values (of two bands). An example case of the
NDVI for figure 3 (image.tif) is computed from DN values as given in table 2 for each pixel for the
entire image and the output NDVI values as computed is given in table 7. It is evident from the table 7
is that after computation the raw NDVI value ranges from -1 to +1. The NDVI range is symmetrical
around zero (NIR = R).
Table 7. NDVI values of the above depicted satellite image (Image.tif) ranging from -1 to +1
NDVI NDVI NIR- NDVI
45
NIR- 123
NIR+R 0.365854 NIR-
-14 230
NIR+R -0.06087 R 122 170
NIR+R 0.717647
R46 150 0.306667 R -7 235 -0.02979 80 172 0.465116
31 179 0.173184 -3 191 -0.01571 66 180 0.366667
21
22
a b
Figure 6. Correlation between one band to the other of Image.tif: a) Positive and b) Negative
The trendlines denote the axis along which the values are plotted. The correlation (scatter) plot will
depicts redundancy in information when the pixels values of each band are plotted with the other
bands of Landsat 8. Applying PCA reduces this redundancy and thus, also compact the data to be
investigated. PCA through transformation creates new images from the uncorrelated values of different
images using a linear transformation of correlated variables that correspond to a rotation (of axis of the
spectral space) and translation of the original coordinate system (or pixel values). After rotation, the
length and the direction of the widest transect of the scattered ellipse is calculated. The transect
corresponding to the resulting longest or major axis of the spectral space or ellipse that contains the
new pixel value, is called the first principal component (PC1). Geometrically, PC1 points in the
direction with the largest variance. PC2 being orthogonal or perpendicular to PC1, points to the second
largest variance. For a n-dimensional space (spectral bands), the same pattern is repeated. The
direction (of variation) of the PC1 is called as the first eigenvector, and the variance (or proportionally
the length of the axis of variation) is called as the first eigenvalue. Algebraically, the basis of
eigenvector and eigenvalue is the data's variance-covariance matrix and correlation matrix. The
method also called as eigen vector decomposition (EVD) or spectral decomposition, thus, decomposes
the variance-covariance matrix and correlation matrix of the raw data into matrices of eigenvector and
eigenvalue. The eigenvectors act as weighting coefficients. The transformation basically maximize the
23
A result after applying the SVD based PCA on the 3-band image (Image.tif) is given below.
Rotation (n x k) = (3 x 3):
PC1 PC2 PC3
-0.7096016 -0.6835029 0.1711416
-0.4203901 0.6056170 0.6756480
-0.5654536 0.4074946 -0.7170846
24
25
8. Image Classification
In remote sensing, the information hidden in multispectral image pixels or band pixels can be
understood in a variety of ways and image classification is one of the those ways. In classification, the
bands are sometimes also called as features, the band pixel value as feature vector and the graph or
plot showing the feature vector as feature space. Image classification is basically about classifying the
'pattern' of rectangular matrix of n-by-n pixels in to classes such as land use/land cover (LU/LC)
classes. The pattern in a multispectral classification will use pixel value or DN. The pixel based
classification groups the similar pixels into classes. This can be performed by simply comparing pixels
values to one another or training the samples of pixels of known identity and then classifying the
pattern based on the training samples. The resulting classes are clusters or regions in a map form, each
of which is identified by a unique color or symbol. In this way, spectral or pixel-based classification,
which is more common, use the pixel information stored in different bands of an image. Whereas the
spatial classification use the spatial relationship of the pixels with its neighboring pixels which may
involve proximity, size, shape, directionality, texture etc. It is important to mention here that there is
no single 'right' approach for image classification, but it depends on the objective of the classification,
nature of the data to be classified and available resources. A classification can be divided into four
phases: training phase where number of classes are defined, analysis of training statistics, assignment
where every pixel is included in any of the defined classes, and map output and assessment that may
include map, table etc. It is also essential to perform geometric and radiometric calibration before
classification. The image classification technique can be broadly categorized in to two: supervised and
unsupervised.
2pi 2 (11)
k-means
28
k 2
D xi C j (12)
i 1 xi Ck
where, there are k clusters Ck with iterations i beginning from 1 to k, D is the total intra-cluster
variance or the squared error function, xi is the data point (vector data) and Cj is the mean vector or
cluster centre. The minimum computational complexity of the k-means algorithm is O(ndCT), where n
is the number of d-dimensional pattern, d is the number of feature vectors, C is the number of assigned
clusters and T is the number of iterations.
A result obtained after applying unsupervised approach using Iterative Self-Organizing Data Analysis
(ISODATA) clustering technique is shown in figure 8d.
(a) Training samples (AOI) on Satellite Image (b) Hybrid Classified Map
29
Open Area
ISODATA clustering is a variant of k-means. In this, splitting and merging of the cluster occurs when
Semi Opencomputationally
the cluster variance is above a pre-determined threshold. The ISODATA, although Area
more intensive than the k-means algorithm, does not solve for a pre-determined number of clusters. It
is quite more adaptive as it try hard to optimize a cluster solution.
(13)
User accuracy, related to commission error, is the proportion of samples classified as a particular
category in the map which are correctly classified.
(14)
Similar to accuracy, there are two kind of errors: Omission and Commission. The omission error
denote the unlinked reference features, where as commission error, also called as false detection, is the
candidate features that could not be linked to the reference features.
Similarly, root mean square error (RMSE) can also be determined.
2
n x x where, x = observed value, and xi = reference value. (15)
RMSE i
1 n and misclassification (due to confusion between the classes) for each class is
The overalli errors
form of a matrix, which is called as error matrix. The misclassification is caused by
represented in the
the classifier algorithm due to a statistical confusion for assignment of pixel vector of features in to a
particular class. This confusion occurs due to close matching of pixel values in each of the bands
(features) for each class. This is the reason why error matrix is also called as confusion matrix. The
error or confusion matrix is consist of n×n array, where n is the number of classes. An example of error
matrix is shown below.
31
After preparation of the error matrix, a parameter called as KHAT or Cohen's Kappa statistics is used
to determine whether one error matrix is significantly different from another. The coefficient measures
the difference between the actual difference in the error matrix or observed accuracy (or true
agreement) and the chance agreement. The observed accuracy or true agreement is the agreement
between remotely sensed classification and the reference data. The chance agreement is an agreement
between reference data and a random classifier.
(16)
Thus, when the observed accuracy or true agreement is 1 and chance agreement is 0, the KHAT
approaches 1. This indicates that the classification result is much better than a random classification. If
f KHAT is zero, then there is no difference between the classification result and a random
classification. If KHAT is less than zero, the classification result is worse than a random classification.
32
33
34
35