0% found this document useful (0 votes)
244 views16 pages

DRDO Report

The training report details an internship at the Defence Laboratory, Jodhpur, where the author, Shakshi Patra, focused on image processing using OpenCV and Python, as well as GIS image analysis with QGIS. The project involved exploring various image processing techniques, including filtering, edge detection, and image segmentation, while applying mathematical concepts to enhance satellite imagery. The report includes acknowledgments, a certificate of completion, and a comprehensive overview of the methodologies and tools utilized during the training period from January 8 to April 8, 2024.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
244 views16 pages

DRDO Report

The training report details an internship at the Defence Laboratory, Jodhpur, where the author, Shakshi Patra, focused on image processing using OpenCV and Python, as well as GIS image analysis with QGIS. The project involved exploring various image processing techniques, including filtering, edge detection, and image segmentation, while applying mathematical concepts to enhance satellite imagery. The report includes acknowledgments, a certificate of completion, and a comprehensive overview of the methodologies and tools utilized during the training period from January 8 to April 8, 2024.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Training report

Image Processing using OpenCV & Python and GIS image analysis using
QGIS

At
Defence Laboratory, Jodhpur(DLR)
Defence Research and Development Organization (DRDO)

Internship Period: 08.01.24 to 08.04.24

Submitted By :- Submitted To :-

Ms, SHAKSHI PATRA Sh. R. K. Khatri

B. Tech, CSE 4thyear Scientist=‘F’

(KIIT University, Bhubaneswar)

ACKNOWLEDGEMENT

It brings me immense satisfaction to have concluded my research training at the


esteemed Defence Laboratory (DRDO) in Jodhpur and to present the comprehensive
training report reflecting my learning. My pleasure in thanking Sh. RV Hara Prasad,
Director, Defence Lab Jodhpur for having permitted me to carry out this project
work. I would like to thank Dr. R Vijay Raghavan, HOD, Camouflage Division for
support and facilities made available.

I wish to express our deep sense of gratitude to Sh. R. K. Khatri, Scientist ‘F’ and Dr.
S. L. Borana, for there guidance and useful suggestions, which helped us in
completing the project work on time. I would also like to thanks HRD Section for
providing necessary administrative support.

Shakshi Patra.

CERTIFICATE

This is to certify that Shakshi Patra (B.Tech, 4th year CSE, KIIT
University,Bhubaneswar) has undertaken Practical Training on

“Image Processing using OpenCV & Python and GIS image analysis using QGIS”

The training was conducted at Defence Laboratory, Jodhpur under my supervision


and guidance during from 08.01.24 till 08.04.24

Date: 08.04.24
Place: Defence Laboratory, Jodhpur R. K. Khatri

ABSTRACT

This project explores the realm of image processing filters and remote sensing of
satellite image classification through QGIS. Image processing filters serve as
indispensable tools for enhancing, sharpening, and extracting features from satellite
imagery. Leveraging the capabilities of QGIS, a widely-used open-source geographic
information system, this study investigates the implementation of various filters for
pre-processing satellite images. To achieve these objectives, I have used Python-
programming and various Python-based dependencies like OpenCV and Tkinter. I
have learned various mathematical aspects of different processing techniques which
make the use of core mathematical knowledge of wide range of topics like vectors,
matrices,statistics and linear systems.

Furthermore, I have explained the process of satellite image classification, a crucial


task in remote sensing applications, facilitated by QGIS's robust toolset and
algorithms. Through a synthesis of theoretical insights and practical applications, this
abstract offers a concise overview of the methods and utilities employed in image
processing and classification within the QGIS environment.

Table of Contents:

S.No. Components Page No.


1. Introduction
2. Types of images
3. Phases of image processing
4. Dependencies
5. Processing filters
6. Edge Detection
7. Morphological Operators
8. Fourier Transform
9. Segmentation
10. Histogram
11. Supervised v/s Unsupervised
12. Landsat-8 image
13. QGIS Raster File
14. Supervised classification in QGIS
15. Unsupervised classification in QGIS
16. Conclusion
17. References

Introduction:

In essence, image processing filters are computational algorithms designed to alter


the appearance of digital images by modifying pixel values based on predefined rules
or mathematical operations. These filters can enhance image quality, remove noise,
highlight specific features, and extract valuable information, thereby enabling a
myriad of applications in fields such as medicine, astronomy, remote sensing,
surveillance, and more.
In this project I have highlighted one of the application of image processing i.e.
remote sensing through landsat-8 image classification.

Types of Images / How Machines “See” Images?


Digital images are interpreted as 2D or 3D matrices by a computer, where each value or
pixel in the matrix represents the amplitude, known as the “intensity” of the pixel.
Typically, we are used to dealing with 8-bit images, wherein the amplitude value ranges
from 0 to 255.

Thus, a computer “sees” digital images as a function: I(x, y) or I(x, y, z), where “I” is the
pixel intensity and (x, y) or (x, y, z) represent the coordinates (for binary/grayscale or
RGB images respectively) of the pixel in the image.

1. Binary Image : Images that have only two unique values of pixel intensity- 0
(representing black) and 1 (representing white) are called binary images. Such images
are generally used to highlight a discriminating portion of a colored image. For example,
it is commonly used for image segmentation

2. Grayscale Image : Grayscale images contain shades of gray, ranging from black to
white, with each pixel representing a different level of intensity. Examples include
medical imaging and document scanning.

3. RGB Image : A RGB image is a type of digital image that represents color using
three primary colors: red, green, and blue (hence the acronym RGB). In this model,
each pixel in the image is represented by three intensity values corresponding to
these primary colors.

4. RGBA Image : It extends the RGB color model by adding an alpha channel for
controlling transparency. It enables the creation of visually appealing graphics and
images with smooth blending and overlay effects, making it a valuable tool in digital
design and multimedia applications.

Phases of Image Processing


1. Image Acquisition
The image is captured by a camera and digitized (if the camera output is not digitized
automatically) using an analogue-to-digital converter for further processing in a
computer.

2. Image Enhancement
In this step, the acquired image is manipulated to meet the requirements of the specific
task for which the image will be used. Such techniques are primarily aimed at
highlighting the hidden or important details in an image, like contrast and brightness
adjustment, etc. Image enhancement is highly subjective in nature.

3. Image Restoration
This step deals with improving the appearance of an image and is an objective operation
since the degradation of an image can be attributed to a mathematical or probabilistic
model. For example, removing noise or blur from images.

4. Color Image Processing


This step aims at handling the processing of colored images (16-bit RGB or RGBA
images), for example, peforming color correction or color modeling in images.

5. Wavelets and Multi-Resolution Processing


Wavelets are the building blocks for representing images in various degrees of
resolution. Images subdivision successively into smaller regions for data compression
and for pyramidal representation.

6. Image Compression
For transferring images to other devices or due to computational storage constraints,
images need to be compressed and cannot be kept at their original size. This is also
important in displaying images over the internet; for example, on Google, a small
thumbnail of an image is a highly compressed version of the original. Only when you
click on the image is it shown in the original resolution. This process saves bandwidth on
the servers.

7. Morphological Processing
Image components that are useful in the representation and description of shape need
to be extracted for further processing or downstream tasks. Morphological Processing
provides the tools (which are essentially mathematical operations) to accomplish this.

8. Image Segmentation
This step involves partitioning an image into different key parts to simplify and/or
change the representation of an image into something that is more meaningful and
easier to analyze. Image segmentation allows for computers to put attention on the
more important parts of the image, discarding the rest.

9. Representation and Description


Image segmentation procedures are generally followed by this step, where the task for
representation is to decide whether the segmented region should be depicted as a
boundary or a complete region. Description deals with extracting attributes that result in
some quantitative information of interest or are basic for differentiating one class of
objects from another.

10. Object Detection and Recognition


After the objects are segmented from an image and the representation and description
phases are complete, the automated system needs to assign a label to the object—to let
the human users know what object has been detected, for example, “vehicle” or
“person”, etc.

11. Knowledge Base


Knowledge may be as simple as the bounding box coordinates for an object of interest
that has been found in the image, along with the object label assigned to it. Anything
that will help in solving the problem for the specific task at hand can be encoded into
the knowledge base.

Dependencies

1) OpenCV
Open Source Computer Vision Library is a powerful open-source library for computer
vision and image processing tasks. It provides a wide range of functionalities,
including image and video capture, manipulation, object detection, tracking, and
machine learning. Its cross-platform compatibility and support for multiple
programming languages make it accessible to developers across different platforms
and environments, facilitating rapid prototyping and deployment of computer vision
applications.

2) Tkinter
Tkinter is a Python library for creating graphical user interfaces (GUIs). It provides a
simple and intuitive way to build desktop applications with widgets like buttons,
labels, and entry fields. Tkinter is included with Python, making it easily accessible
for developers. Despite its simplicity, Tkinter offers flexibility and customization
options, enabling developers to design attractive and functional GUIs for a wide
range of applications, from simple utilities to complex desktop software.

3) QGIS
Quantum Geographic Information System, is a software used for geographic
information system (GIS) applications. It provides a user-friendly interface for
viewing, editing, and analyzing spatial data, making it accessible to both beginners
and professionals. QGIS supports a wide range of data formats and offers advanced
geospatial analysis tools, including spatial querying, map composition, and
geoprocessing functions. With its extensive plugin architecture, QGIS allows for
customization and integration with other geospatial tools and data sources.

4) USGS
The United States Geological Survey (USGS) website serves as a comprehensive
resource for geological, topographical, hydrological, and biological data and
information. It offers a vast array of resources including maps, datasets, publications,
and tools related to earth sciences. Users can access information on earthquakes,
volcanoes, water resources, land use, ecosystems, and more. The USGS website also
provides real-time monitoring and alerts for natural hazards such as earthquakes and
floods. Additionally, it offers interactive mapping tools and applications for exploring
geospatial data.

Image Processing Filters

Linear filters - Linear filtering is the filtering method where the value of output
pixel is linear combinations of the neighboring input pixels. It can be done with
convolution operation. For example, mean/average filters or Gaussian filter.

Non-Linear filters - Non-linear filter is a filter whose output is not a linear


function of its input. Non-linear filtering cannot be done with convolution or Fourier
multiplication. Median filter is a simple example of a non-linear filter.

I have implemented some common types of image processing filters:

1) Mean Filter- Mean filter, a type of smoothing filter, replaces each pixel's value
with the average of its neighboring pixels. It reduces noise and preserves image
edges to some extent.
def mean(kernel_size=7):
path=file()
image2 = cv2.imread(path)
kernel = np.ones((kernel_size, kernel_size), np.float32) / (kernel_size *
kernel_size)
filtered_image = cv2.filter2D(image2, -1, kernel)
blue,green,red = cv2.split(filtered_image)
img = cv2.merge((red,green,blue))
im = Image.fromarray(img)
resize_image = im.resize((300, 200))
img = ImageTk.PhotoImage(resize_image)

2) Median Filter- Median filter in image processing replaces each pixel's value with
the median value of its neighborhood, effectively reducing noise while preserving
edges and fine details.

def median():
kernel_size=7
path=file()
image = cv2.imread(path)
pad = kernel_size // 2
padded_image = np.pad(image, pad, mode='reflect')
output = np.zeros_like(image)
for i in range(image.shape[0]):
for j in range(image.shape[1]):
window = padded_image[i:i+kernel_size, j:j+kernel_size]
output[i, j] = np.median(window)
3) Gaussian Filter- The Gaussian filter is a smoothing filter used in image processing
to reduce noise and blur images. It convolves the image with a Gaussian kernel,
emphasizing central pixels.

def gaussian():
path=file()
image = cv2.imread(path)
blurred_image = cv2.GaussianBlur(image, (5, 5),sigmaX=2.0)
im = Image.fromarray(blurred_image)
resize_image = im.resize((300, 200))
img = ImageTk.PhotoImage(resize_image)

4) Laplacian Filter- The Laplacian filter is an edge detection filter in image processing
that enhances edges by highlighting regions of high spatial frequency, aiding in edge
detection and feature extraction.

def laplacian(kernel_size=3):
path=file()
image = cv2.imread(path)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (kernel_size, kernel_size), 0)
dst = cv2.Laplacian(blurred, cv2.CV_16S, ksize=kernel_size)
laplacian_image = cv2.convertScaleAbs(dst)
im = Image.fromarray(laplacian_image)
Edge Detection

This identifies and highlights the edges or boundaries between different objects or
regions in an image. They are commonly used in tasks such as object detection,
segmentation, and feature extraction. Popular edge detection filters include the
Sobel filter, the Prewitt filter, and the Canny edge detector.

1) Canny Edge- Canny edge detection is a multi-stage algorithm in image processing,


detecting edges by identifying pixels with high gradient values and applying
hysteresis thresholding for edge linking.

2) Sobel- The Sobel operator is a convolutional filter used in edge detection to


highlight edges by calculating the gradient magnitude, emphasizing changes in
intensity in an image.
3) Prewitt- Prewitt operator is an edge detection filter in image processing, utilizing a
pair of convolution kernels to compute gradients and highlight edges, aiding in edge
detection and feature extraction.

Morphological operators

These manipulate the shape and structure of objects within an image. They are used
to perform operations such as erosion, dilation, opening, and closing, which can
remove noise, fill gaps, or modify the size and shape of objects.

1) Dilation- Dilation is a morphological operation in image processing that expands


or thickens regions of interest within an image. It involves moving a structuring
element (kernel) over the image and setting the pixel value to 1 if at least one pixel
under the kernel is 1.

2) Erosion- Erosion is a morphological operation in image processing that reduces


the size of objects by removing pixels at the object boundaries. It is often used to
eliminate small features or to separate objects that are connected.
3) Opening- Opening is a morphological operation in image processing that consists
of two sequential steps: erosion followed by dilation. It is used to remove small
objects, smooth boundaries, and separate objects that are touching or overlapping
in binary or grayscale images.

4) Closing- Closing in morphological operators is a dilation operation followed by an


erosion operation, used to close small gaps and smooth boundaries in binary images,
enhancing and filling in details.

Fourier Transform(FT)
FT in image processing acts like a translator. It breaks down an image (spatial
domain) into its fundamental frequency components (frequency domain). This
reveals how much of the image information lies in low (smooth areas), medium
(edges), and high frequencies (details).
By manipulating the frequency components in the transformed domain, we can
achieve tasks like:
 Noise reduction (removing high-frequency noise)
 Image sharpening (boosting high frequencies)
 Filtering specific textures or patterns (based on their frequency)

Segmentation

Image segmentation in image processing is the process of partitioning an image into


multiple segments or regions based on certain criteria, such as color, intensity,
texture, or spatial proximity. It aims to divide the image into meaningful and
homogeneous regions to facilitate further analysis and interpretation. There are
various segmentation techniques, including thresholding, region-based methods,
and edge-based methods.
Here I have used semantic segmentation using binary thresholding technique. In
Semantic segmentation we arrange the pixels in an image based on semantic classes.
Every pixel belongs to a specific class, and the segmentation model does not refer to
any other context or information. And thresholding is the simplest image
segmentation method, dividing pixels based on their intensity relative to a given
value or threshold. It is suitable for segmenting objects with higher intensity than
other objects or backgrounds.

def threshold_segmentation(threshold_value=127):
image = cv2.imread(r"C:\Users\KIIT\OneDrive\Desktop\6TH SEM\cake.jpg",
cv2.IMREAD_GRAYSCALE)
ret, thresholded_image = cv2.threshold(image, threshold_value, 255,
cv2.THRESH_BINARY)
resized_image = cv2.resize(thresholded_image, dsize=(300, 200),
interpolation=cv2.INTER_AREA)
cv2.imshow("Resized Image", resized_image)
return 0
Histogram

A histogram in image processing is like a fingerprint for an image's brightness. It's a


bar graph that reveals how many pixels fall into each level of intensity (grayscale
value for black and white images).
-> High peaks indicate concentrations of pixels at specific intensities
-> A flat histogram suggests a uniform distribution of intensities across the image .
Histograms help us:
-> Analyze image contrast and exposure.
-> Apply image enhancement techniques like contrast stretching to improve visual
quality.
->Detect potential problems like overexposure or underexposure.

Illustration shows that each number of pixels


of an image lie upon range of 0 to 255.
Remote Sensing

Remote sensing is a powerful tool for mapping and monitoring the Earth’s surface. It
involves the acquisition and analysis of data from various sensors, such as satellites,
aircraft, and drones. One of the key applications of remote sensing is land cover
classification, which involves categorizing different land cover types based on their
spectral properties.

There are two main approaches to land cover classification: supervised and
unsupervised classification. In this article, we will discuss the difference between
supervised and unsupervised classification in remote sensing.

Classification has been categorized into two types.

1) Supervised classification
Supervised classification of images involves training a machine learning model using
labeled data, where each image is associated with predefined categories. The model
learns to classify new, unlabeled images based on the patterns and features
extracted from the training data, enabling automated image categorization.

2) Unsupervised classification
Unsupervised classification of images involves grouping pixels into clusters based on
their spectral similarity, without prior knowledge of land cover types. Common
techniques include k-means clustering and hierarchical clustering. It's useful for
exploring data patterns but may require post-processing to interpret clusters into
meaningful land cover classes.

Comparison of Supervised Vs. Unsupervised Classification In Remote


Sensing

Unsupervised
Features Supervised Classification
Classification

No training data
Training data User provides training data
required

Algorithm identifies
Algorithm User selects the algorithm
natural groupings

User assigns land-


Accuracy User compares classified pixels
cover classes to
assessment with validation data
clusters manually

Number of User specifies the number of Algorithm determines


classes classes the number of classes
Appropriate
Specific land-cover classes Exploratory studies
for

More accurate if training data is Less accurate than


Accuracy representative and algorithm is supervised
chosen correctly classification

Dependent on user
Dependent on quality of training interpretation and
Challenges
data and algorithm determination of
number of classes

Land-use and land-cover


mapping, environmental
monitoring, natural resources Same as supervised
Applications
management, disaster classification
management, urban planning,
agriculture and forestry

Conclusion

In summary, the research training undertaken at Defence Laboratory, Jodhpur has


been instrumental in bridging the gap between theoretical understanding and
practical application. This training has fostered a robust comprehension of how
theory translates into real-world scenarios. Throughout the training duration, I have
acquired invaluable insights that will undoubtedly benefit my future endeavors.

Specifically, I have delved into the image processing tools and landsat image analysis,
recognizing their vast potential for future research endeavors. My exploration of
various image filtering techniques and image classification will be useful in an
application domain. Moreover, both supervised and unsupervised classification are
important techniques in remote sensing. Supervised classification is more accurate
and reliable, but it requires more effort and expertise. Unsupervised classification
is faster and easier, but it may not be suitable for all applications.

References

1) Digital Image Processing 3rd ed. - R. Gonzalez, R. Woods-ilovepdf-compressed


2) 1602413535-digital-image-processing-using-matlab-2nd-ed-2009
3) Boyle and R. Thomas Computer Vision: A First Course, Blackwell Scientific
Publications, 1988, pp 32 - 34.
4) Maru, M & Parikh, M.C. 2017. Image Restoration Techniques: A Survey.
International Journal of Computer Applications. 160(6).

You might also like