Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
57 views51 pages

GRP Mini Dynamic

The document is a mini project report on a dynamic target tracking method for surveillance video based on image processing, submitted to Jawaharlal Nehru Technological University by a group of students. It outlines the importance of accurate tracking in surveillance applications and presents a method that combines various image processing techniques for effective target detection and tracking. The report includes acknowledgments, a declaration of originality, and an abstract summarizing the project's objectives and results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views51 pages

GRP Mini Dynamic

The document is a mini project report on a dynamic target tracking method for surveillance video based on image processing, submitted to Jawaharlal Nehru Technological University by a group of students. It outlines the importance of accurate tracking in surveillance applications and presents a method that combines various image processing techniques for effective target detection and tracking. The report includes acknowledgments, a declaration of originality, and an abstract summarizing the project's objectives and results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

DYNAMIC TARGET TRACKING METHOD OF SUREVILLANCE

VIDEO BASED ON IMAGE PROCESSING


A Mini project report submitted to

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD

In partial fulfillment of the requirement for the award of the degree of

BACHELOR OF TECHNOLOGY

In
ELECTRONICS AND COMMUNICATION ENGINEERING
By

GANGISHETTI SHIVANI (21TR1A0439)


ANASURI SANDEEP (22TR5A0401)

GOLLAPALLY SANDEEP (21TR1A0441)

DEEKONDA SHIVA SAI (21TR1A0430)

Under the Guidance of

Mrs. P. SAGARIKA

Assistant Professor

Department of Electronics and Communication Engineering,

SREE CHAITANYA INSTITUTE OF TECHNOLOGICAL SCIENCES

(Approved by AICTE, New Delhi, Affiliated to JNTUH, Hyderabad)

THIMMAPOOR, KARIMNAGAR, TS-505 527.

2021-2025
SREE CHAITANYA INSTITUTE OF TECHNOLOGICAL SCIENCES

(Approved by AICTE, New Delhi, Affiliated to JNTUH, Hyderabad)

THIMMAPOOR, KARIMNAGAR, TS-505 527.

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

CERTIFICATE
This is to certify that the Mini project report entitled “DYNAMIC TARGET
TRACKING METHOD OF SURVEILLANCE VIDEO BASED ON IMAGE
PROCESSING” is being submitted by GANGISHETTI SHIVANI (21TR1A0439),
ANASURI SANDEEP (22TR5A0401),GOLLAPALLY SANDEEP (21TR1A0441),
DEEKONDA SHIVASAI (21TR1A0430) in partial fulfillment of the requirements for
the award of the Degree of Bachelor of Technology in Electronics and
Communication Engineering, to the Sree Chaitanya Institute Of Technological
Sciences ,karimnagar,is a bonafide work carried out by them under my guidance and
supervision.

Under the Guidance of Head of the department

Mrs. P. SAGARIKA Dr. V. PRAVEENKUMAR


Assistant Professor Professor & HOD
Department of ECE HOD, Department of ECE
Sree Chaitanya Institute of Sree Chaitanya Institute of
Technological Sciences. Technological Sciences.

EXTERNAL EXAMINER
ACKNOWLEDGEMENTS

The Satisfaction that accomplishes the successful completion of any task would
be incomplete without the mention of the people who make it possible and whose
constant guidance and encouragement crown all the efforts with success.

It is our privilege and pleasure to express our profound sense of respect,


gratitude and indebtedness to our guide Mrs. P. SAGARIKA, Assistant Professor
Department of ECE, SCITS, for her constant guidance, inspiration, and constant
encouragement throughout this Mini project work.
We wish to express our deep gratitude to Dr. V. PRAVEEN KUMAR,
Professor and HOD, Department of ECE, SCITS, Karimnagar for his cooperation and
encouragement, in addition to providing necessary facilities throughout the Mini
Project work.

We sincerely extend our thanks to Dr. A. PRASAD RAJU, Principal, SCITS,


Karimnagar, for providing all the facilities required for completion of this Project.

We would like to thank all the staff and all our friends for their good wishes,
their helping hand and constructive criticism, which led the successful completion of
this Mini project.

We are immensely indebted to our parents, brothers and sisters for their love and
unshakable belief in us and the understanding and ever-decreasing grudges for not
spending time more often. We will now, since the excuse is in the process of vanishing
by being printed on these very pages.

Finally, we thank all those who directly and indirectly helped us in this regard.
We apologize for not listing everyone here.

GANGISHETTI SHIVANI (21TR1A0439)

ANASURI SANDEEP (22TR5A0401)

GOLLAPALLY SANDEEP (21TR1A0441)

DEEKONDA SHIVASAI (21TR1A0430)

III
DECLARATION

We here by declare that the work which is being presented in this dissertation
entitled, “DYNAMIC TARGET TARCKING METHOD OF SURVEILLANCE
VIDEO BASED ON IMAGE PROCESSING”, submitted towards the partial
fulfillment of the requirements for the award of the degree of Bachelor of Technology in
Electronics and Communication Engineering, SCITS, Karimnagar, is an authentic
record of our own work carried out under the guidance of Mrs. P. SAGARIKA,
Assistant professor, Department of ECE, SCITS, Karimnagar.

To the best of our knowledge and belief, this Mini project bears no resemblance
with any report submitted to SCITS or any other University for the award of any degree
or diploma.

Date: GANGISHETTI SHIVANI (21TR1A0439)

Place: Karimnagar ANASURI SANDEEP (22TR5A0401)

GOLLAPALLY SANDEEP (21TR1A0441)

DEEKONDA SHIVASAI (21TR1A0430)

IV
ABSTARCT

Dynamic target tracking plays a crucial role in various surveillance applications,


such as video surveillance, traffic monitoring, and human activity recognition. Accurate
tracking of moving objects over time is essential for understanding their behavior,
predicting future movements, and ensuring security in dynamic environments. This
project presents a dynamic target tracking method for surveillance video using advanced
image processing techniques. The approach focuses on detecting and continuously
tracking moving targets across successive frames. It combines object detection methods,
such as background subtraction and optical flow, with segmentation techniques like k-
means clustering for color-based object segmentation.

The performance of the proposed tracking system is evaluated across different


scenarios, including crowded scenes and varying camera perspectives. The experimental
results demonstrate that the method provides reliable tracking with minimal errors,
outperforming traditional tracking approaches in terms of accuracy and robustness. This
method is especially effective in real-time surveillance systems, offering valuable
insights into target behaviors and aiding in automated security and monitoring systems.

V
CONTENTS

TITLE PAGENO

ACKNOWLEDGEMENT iii

DECLARATION iv

ABSTRACT v

CONTENTS vi

LIST OF FIGURES xi

CHAPTER-1

INTRODUCTION 1

CHAPTER-2

INDUSTRY TO MATLAB

2.1 What is MATLAB 3

2.2 The MATLAB System 4

2.2.1 Development Environment 4

2.2.2 The MATLAB Mathematical Function 4

2.2.3 The MATLAB Language 4

2.2.4 Graphics 5

2.2.5 The MATLAB API 5

2.3 MATLAB Working Environment 5

VI
CHAPTER-3

DIGITAL IMAGE PROCESSING 8

3.1 Background 8

3.2 What is DIP 8

3.3 What is an image 9

3.3.1 Gray scale image 9

3.3.2 Colour image 10

3.3.3 Coordinate convention 10

3.4 Image as Matrices 11

3.5 Reading Images 12

3.6 Data Classes 13

CHAPTER-4

IMAGE TYPES 15

4.1 Intensity Images 15

4.2 Binary Images 16

4.3 Indexed Images 16

4.4 RGB Images 17

CHAPTER-5

SOFTWARE INTRODUCTION 19

5.1 Starting and Quitting matrices 19

5.2 Desktop Tools 20

5.3 Manipulating Matrices 23

5.4 Expressions 24

5.4.1 Variables 24

5.4.2 Numbers 24

VII
5.4.3 Operators 24

5.4.4 Functions 25

CHAPTER-6

USER INTERFACE CONTROL 26

6.1 Push buttons 26

6.2 Toggle Buttons 27

6.3 Radio Buttons 27

6.4 Checkboxes 28

6.5 Edit Text 28

6.6 Static Text 29

6.7 Frames 29

6.8 List Boxes 30

6.9 Popup Menus 30

6.10 Axes 32

CHAPTER-7

PROPOSED SYSTEM 33

7.1 Benefits 33

7.2 Existing System 34

7.2.1 Drawbacks 34

RESULT 35

CONCLUSION 37

SORCE CODE 38

REFERENCE 41

VIII
LIST OF FIGURES
FIG.NO DESCRIPTION PAGE.NO
FIG 3.3: Gray scale image 9

FIG 4.1: Intensity image 15

FIG 4.2: Binary image 16

FIG 4.3: Indexed image 17

FIG 4.5: RGB image 18

IX
CHAPTER 1
INTRODUCTION
Detection and segmentation of moving objects in video streams is an essential
process for information extraction in many computer vision applications, including
video surveillance, human tracking, traffic monitoring and semantic annotation of
videos. Surveillance system uses video cameras to monitor the activities of targets
(human, vehicle, etc.) in a scene [1]. In order to obtain an automatic motion
segmentation algorithm that can work with real images there are several issues that need
to be solved, particularly important are: noise, missing data and lack of a priori
knowledge. One of the main problems is the presence of noise. For some applications
the noise level can become critical. There are three conventional approaches to moving
object detection: background subtraction, temporal differencing and optical flow [2].

Background subtraction is one of the most popular methods for novelty


detection in video streams. Background Subtraction generates a foreground mask for
every frame. This step is simply performed by subtracting the background image from
the current frame. When the background view excluding the foreground objects is
available, it becomes obvious that the foreground objects can be obtained by
comparing the background image with the current video frame. It focuses on two
major steps: First, to construct a statistical representation of the background that is
representative, robust to noise and sensitive to new objects; second, to build another
statistical model called ‘foreground’ that represents the changes that take place on the
scene[3]-[4]. By applying this approach to each frame one can effectively track any
moving object. Moreover, a background image can be elegantly used to determine the
foreground objects by comparing the input frame with the background image and
marking the differences as foreground objects. This technique is commonly known as
background subtraction or change detection.

In segmentation process the image/frame is splitted into a set of non-


overlapping uniform connected regions such that any two adjacent ones are not
similar.Most of these segmentation algorithms are based on similarity, difference and
particularly, can be divided into different categories: threshold, template matching,
region growing, edge detection and clustering [5].

1
These methods have been proven to be successful in many applications, but
none of them are generally applicable to all images and moving objects and different
algorithms are usually not equally suitable for a particular application. Image
segmentation is the partitioning of an image in objects of interest. This partitioning is
done according to some subjective criteria and, usually, it aims to separate the objects
in the image. Object segmentation techniques known as Region of Interest (ROI) has
recently drawn much attention in image compression community. ROI applications
include browsing, digital image archive, and telemedicine [6]-[7]. Many computer
vision methods have been developed for analyzing image motion. These methods
have addressed a diverse set of natural motion categories including smooth optical
flow, discontinuous optical flow across an occlusion boundary, and motion
transparency.

In this work, an algorithm for detection and segmentation of objects in the


video frames is presented. The algorithm is based on object detection from
background using the background subtraction method and segmentation using
thresholding and edge detection. The performance evaluation using these methods
with different sample videos is discussed in this work.

2
CHAPTER 2

INTRODUCTION TO MATLAB

2.1 What is MATLAB?

MATLAB® is a high-performance language for technical computing. It


integrates computation, visualization, and programming in an easy-to-use
environment where problems and solutions are expressed in familiar mathematical
notation. Typical uses include

Math and computation

Algorithm development

Data acquisition

Modeling, simulation, and prototyping

Data analysis, exploration, and visualization

Scientific and engineering graphics

Application development, including graphical user interface building.

MATLAB is an interactive system whose basic data element is an array that


does not require dimensioning.

This allows you to solve many technical computing problems, especially those
with matrix and vector formulations, in a fraction of the time it would take to write a
program in a scalar non interactive language such as C or FORTRAN.

The name MATLAB stands for matrix laboratory. MATLAB was originally
written to provide easy access to matrix software developed by the LINPACK and
EISPACK projects. Today, MATLAB engines incorporate the LAPACK and BLAS
libraries, embedding the state of the art in software for matrix computation.

MATLAB has evolved over a period of years with input from many users. In
university environments, it is the standard instructional tool for introductory and

3
advanced courses in mathematics, engineering, and science. In industry, MATLAB is
the tool of choice for high-productivity research, development, and analysis.

MATLAB features a family of add-on application-specific solutions called


toolboxes. Toolboxes are comprehensive collections of MATLAB functions (M-files)
that extend the MATLAB environment to solve particular classes of problems. Areas
in which toolboxes are available include signal processing, control systems, neural
networks, fuzzy logic, wavelets, simulation, and many others.

2.2 The MATLAB system:

The MATLAB system consists of five main parts:

2.2.1 Development environment:

This is the set of tools and facilities that help you use MATLAB functions and
files. Many of these tools are graphical user interfaces. It includes the MATLAB
desktop and Command Window, a command history, an editor and debugger, and
browsers for viewing help, the workspace, files, and the search path.

2.2.2 The MATLAB mathematical function:

This is a vast collection of computational algorithms ranging from elementary


functions like sum, sine, cosine, and complex arithmetic, to more sophisticated
functions like matrix inverse, matrix eigen values, Bessel functions, and fast Fourier
transforms.

2.2.3 The MATLAB language:

This is a high-level matrix/array language with control flow statements,


functions, data structures, input/output, and object-oriented programming features.

4
It allows both "programming in the small" to rapidly create quick and dirty
throw-away programs, and "programming in the large" to create complete large and
complex application programs.

2.2.4 Graphics:

MATLAB has extensive facilities for displaying vectors and matrices as


graphs, as well as annotating and printing these graphs. It includes high-level
functions for two-dimensional and three-dimensional data visualization, image
processing, animation, and presentation graphics. It also includes low-level functions
that allow you to fully customize the appearance of graphics as well as to build
complete graphical user interfaces on your MATLAB applications.

2.2.5 The MATLAB Application Program Interface (API):

This is a library that allows you to write C and Fortran programs that interact
with MATLAB. It includes facilities for calling routines from MATLAB (dynamic
linking), calling MATLAB as a computational engine, and for reading and writing
MAT-files.

2.3 MATLAB WORKING ENVIRONMENT:

Matlab Desktop:-

Matlab Desktop is the main Matlab application window. The desktop contains
five sub windows, the command window, the workspace browser, the current
directory window, the command history window, and one or more figure windows,
which are shown only when the user displays a graphic.

MATLAB defines the workspace as the set of variables that the user creates in a work
session. The workspace browser shows these variables and some information about
them.

5
Double clicking on a variable in the workspace browser launches the Array
Editor, which can be used to obtain information and income instances edit certain
properties of the variable.

The current Directory tab above the workspace tab shows the contents of the
current directory, whose path is shown in the current directory window.

MATLAB uses a search path to find M-files and other MATLAB related
files, which are organize in directories in the computer file system. Any file run in
MATLAB must reside in the current directory or in a directory that is on search path.
By default, the files supplied with MATLAB and math works toolboxes are included
in the search path. The easiest way to see which directories are on the search path.
The easiest way to see which directories are soon the search path, or to add or modify
a search path, is to select set path from the File menu the desktop, and then use the
set path dialog box. It is good practice to add any commonly used directories to the
search path to avoid repeatedly having the change the current directory.

The Command History Window contains a record of the commands a user has
entered in the command window, including both current and previous MATLAB
sessions. Previously entered MATLAB commands can be selected and re-executed
from the command history window by right clicking on a command or sequence of
commands. This action launches a menu from which to select various options in
addition to executing the commands. This is useful to select various options in
addition to executing the commands. This is a useful feature when experimenting with
various commands in a work session.

Using the MATLAB editor to create M-Files:

The MATLAB editor is both a text editor specialized for creating M-files and a
graphical MATLAB debugger. The editor can appear in a window by itself, or it can
be a sub window in the desktop. M-files are denoted by the extension .m, as in
pixelup.m. The MATLAB editor window has numerous pull-down menus for tasks
such as saving, viewing, and debugging files.

6
Getting help:

The principal way to get help online is to use the MATLAB help browser,
opened as a separate window either by clicking on the question mark symbol (?) on
the desktop toolbar, or by typing help browser at the prompt in the command window.
The help Browser is a web browser integrated into the MATLAB desktop that
displays a Hypertext Markup Language (HTML) documents. The Help Browser
consists of two panes, the help navigator pane, used to find information, and the
display pane, used to view the information. Self-explanatory tabs other than navigator
pane are used to perform a search.

7
CHAPTER 3

DIGITAL IMAGE PROCESSING

3.1 Background:

Digital image processing is an area characterized by the need for extensive


experimental work to establish the viability of proposed solutions to a given problem.
An important characteristic underlying the design of image processing systems is the
significant level of testing & experimentation that normally is required before arriving
at an acceptable solution. This characteristic implies that the ability to formulate
approaches &quickly prototype candidate solutions generally plays a major role in
reducing the cost & time required to arrive at a viable system implementation.

3.2 What is DIP


An image may be defined as a two-dimensional function f (x, y), where x & y
are spatial coordinates, & the amplitude of f at any pair of coordinates (x, y) is called
the intensity or gray level of the image at that point. When x, y & the amplitude
values of f are all finite discrete quantities, we call the image a digital image. The
field of DIP refers to processing digital image by means of digital computer. Digital
image is composed of a finite number of elements, each of which has a particular
location & value. The elements are called pixels.

Vision is the most advanced of our sensor, so it is not surprising that image
play the single most important role in human perception. However, unlike humans,
who are limited to the visual band of the EM spectrum imaging machines cover
almost the entire EM spectrum, ranging from gamma to radio waves. They can
operate also on images generated by sources that humans are not accustomed to
associating with image.

There is no general agreement among authors regarding where image processing


stops & other related areas such as image analysis& computer vision start.

Sometimes a distinction is made by defining image processing as a discipline in


which both the input & output at a process are images.

8
There are no clear-cut boundaries in the continuum from image processing at
one end to complete vision at the other. However, one useful paradigm is to consider
three types of computerized processes in this continuum: low-, mid-, & high-level
processes. Low-level process involves primitive operations such as image processing
to reduce noise, contrast enhancement & image sharpening. A low- level process is
characterized by the fact that both its inputs & outputs are images.

3.3 What is an image?

An image is represented as a two dimensional function f (x, y) where x and y


are spatial co-ordinates and the amplitude of ‘f’ at any pair of coordinates (x, y) is
called the intensity of the image at that point.

3.3.1 Gray scale image:

A grayscale image is a function I (xylem) of the two spatial coordinates of


the image plane.

I(x, y) is the intensity of the image at the point (x, y) on the image plane.

I (xylem) takes non-negative values assume the image is bounded by a rectangle [0, a]
[0, b]I: [0, a]  [0, b] → [0, info)

Fig 3.3.1 Gray scale image


9
3.3.2 Color image:

It can be represented by three functions, R (xylem) for red, G (xylem) for


green and B (xylem) for blue.

An image may be continuous with respect to the x and y coordinates and


also in amplitude. Converting such an image to digital form requires that the
coordinates as well as the amplitude to be digitized. Digitizing the coordinate’s values
is called sampling. Digitizing the amplitude values is called quantization.

3.3.3 Coordinate convention:

The result of sampling and quantization is a matrix of real numbers. We use


two principal ways to represent digital images.

Assume that an image f(x, y) is sampled so that the resulting image has M
rows and N columns. We say that the image is of size M X N.

The values of the coordinates (xylem) are discrete quantities. For notational
clarity and convenience, we use integer values for these discrete coordinates.

In many image processing books, the image origin is defined to be at


(xylem)=(0,0).The next coordinate values along the first row of the image are
(xylem)=(0,1).It is important to keep in mind that the notation (0,1) is used to signify
the second sample along the first row. It does not mean that these are the actual values
of physical coordinates when the image was sampled. Following figure shows the
coordinate convention. Note that x ranges from 0 to M-1 and y from 0 to N-1 in
integer increments.

The coordinate convention used in the toolbox to denote arrays is different


from the preceding paragraph in two minor ways. First, instead of using (xylem) the
toolbox uses the notation (race) to indicate rows and columns. Note, however, that the
order of coordinates is the same as the order discussed in the previous paragraph, in
the sense that the first element of a coordinate topples, (alb), refers to a row and the
second to a column.

10
The other difference is that the origin of the coordinate system is at (r, c) = (1,
1); thus, r ranges from 1 to M and c from 1 to N in integer increments. IPT
documentation refers to the coordinates.

3.4 Image as matrices:

The preceding discussion leads to the following representation for a digitized


image function:

f (0,0) f(0,1) ……….. f(0,N-1)

f (1,0) f(1,1) ………… f(1,N-1)

f (xylem)= . . .

. . .

f (M-1,0) f(M-1,1) ………… f(M-1,N-1)

The right side of this equation is a digital image by definition. Each element of
this array is called an image element, picture element, pixel or pel.

The terms image and pixel are used throughout the rest of our discussions to
denote a digital image and its elements.

A digital image can be represented naturally as a MATLAB matrix:

f (1,1) f(1,2) ……. f(1,N)

f (2,1) f(2,2) …….. f (2,N)

. . .

f= . . .

f (M,1) f(M,2) …….f(M,N)

Where f (1,1) = f(0,0) (note the use of a monoscope font to denote MATLAB).
The notation f(p ,q) denotes the element located in row p and the column q

11
Typically we use the letters M and N respectively to denote the number of
rows and columns in a matrix. A 1xN matrix is called a row vector whereas an Mx1
matrix is called a column vector. A 1x1 matrix is a scalar.

Matrices in MATLAB are stored in variables with names such as A, a, RGB,


real array and so on. Variables must begin with a letter and contain only letters,
numerals and underscores. As noted in the previous paragraph, all MATLAB
quantities are written using mono-scope characters. We use conventional Roman,
italic notation such as f (x ,y), for mathematical expressions

3.5 Reading images:

Images are read into the MATLAB environment using function imread whose
syntax is

Imread (‘filename’)

Format name Description recognized extension

TIFF Tagged Image File Format .tif, .tiff

JPEG Joint Photograph Experts Group .jpg, .jpeg

GIF Graphics Interchange Format .gif

BMP Windows Bitmap .bmp

PNG Portable Network Graphics .png

XWD X Window Dump .xwd

Here filename is a spring containing the complete of the image file (including
any applicable extension). For example the command line

>> f = imread (‘8. jpg’);

Reads the JPEG (above table) image chestxray into image array f. Note the use
of single quotes (‘) to delimit the string filename. The semicolon at the end of a
command line is used by MATLAB for suppressing output If a semicolon is not
included. MATLAB displays the results of the operation(s) specified in that line. The
12
prompt symbol (>>) designates the beginning of a command line, as it appears in the
MATLAB command window.

3.6 Data classes:

Although we work with integers coordinates the values of pixels themselves


are not restricted to be integers in MATLAB. Table above list various data classes
supported by MATLAB and IPT are representing pixels values. The first eight entries
in the table are refers to as numeric data classes. The ninth entry is the char class and,
as shown, the last entry is referred to as logical data class.

All numeric computations in MATLAB are done in double quantities, so this is


also a frequent data class encounter in image processing applications.
Class unit 8 also is encountered frequently, especially when reading data from
storages devices, as 8bit images are most common representations found in practice.
These two data classes, classes logical, and, to a lesser degree, class unit 16 constitute
the primary data classes on which we focus. Many functions however support all the
data classes listed in table. Data class double requires 8 bytes to represent a number
uint8 and int 8 require one byte each, uint16 and int16 requires 2bytes and unit 32.

13
Name Description

Double Double _ precision, floating_ point numbers the Approximate.

Uint8 unsigned 8_bit integers in the range[0,255] (1byte per


Element).

Uint16 unsigned 16_bit integers in the range [0, 65535] (2byte per element)

Uint 32 unsigned 32_bit integers in the range [0, 4294967295](4 bytes per
element).

Int8 signed 8_bit integers in the range [-128,127] 1 byte per element)

Int 16 signed 16_byte integers in the range [32768] (2 bytes per element).

Char characters (2 bytes per elements).

Logical values are 0 to 1 (1byte per element)

14
CHAPTER 4

IMAGE TYPES

The toolbox supports four types of images:

1. Intensity images;

2. Binary images;

3. Indexed images;

4. R G B images.

Most monochrome image processing operations are carried out using binary
or intensity images, so our initial focus is on these two image types. Indexed and RGB
colour images.
4.1 Intensity images:

An intensity image is a data matrix whose values have been scaled to represent
intentions. When the elements of an intensity image are of class unit8, or class unit
16, they have integer values in the range [0,255] and [0, 65535], respectively. If the
image is of class double, the values are floating point numbers. Values of scaled,
double intensity images are in the range [0, 1] by convention.

Fig 4.1 Intensity Image

15
4.2 Binary images:

Binary images have a very specific meaning in MATLAB.A binary image is a


logical array 0s and1s.Thus, an array of 0s and 1s whose values are of data class, say
unit8, is not considered as a binary image in MATLAB .A numeric array is converted
to binary using function logical. Thus, if A is a numeric array consisting of 0s and 1s,

Fig 4.2 Binary Image

we create an array B using the statement.

B=logical (A)

If A contains elements other than 0s and 1s.Use of the logical function


converts all nonzero quantities to logical 1s and all entries with value 0 to logical 0s.

Using relational and logical operators also creates logical arrays.

To test if an array is logical we use the I logical function: islogical(c).

If c is a logical array, this function returns a 1.Otherwise returns a 0. Logical


array can be converted to numeric arrays using the data class conversion functions.

4.3 Indexed images:

An indexed image has two components:

A data matrix integer, x

A color map matrix, map

16
Matrix map is an m*3 arrays of class double containing floating point values
in the range [0, 1]. The length m of the map are equal to the number of colors it
defines. Each row of map specifies the red, green and blue components of a single
color.

An indexed image uses “direct mapping” of pixel intensity values color map
values. The color of each pixel is determined by using the corresponding value the
integer matrix x as a pointer in to map.

If x is of class double, then all of its components with values less than or equal
to 1 point to the first row in map, all components with value 2 point to the second row
and so on. If x is of class units or unit 16, then all components value 0 point to the
first row in map, all components with value 1 point to the second and so on.

Fig 4.3 Indexed Image

4.4 RGB image:

An RGB color image is an M*N*3 array of color pixels where each color
pixel is triplet corresponding to the red, green and blue components of an RGB image,
at a specific spatial location. An RGB image may be viewed as “stack” of three gray
scale images that when fed in to the red, green and blue inputs of a color monitor.

Produce a color image on the screen. Convention the three images forming an
RGB color image are referred to as the red, green and blue components images. The
data class of the components images determines their range of values.

17
Fig 4.4 RGB Image

Similarly, the range of values is [0,255] or [0, 65535]. For RGB images of
class units or unit 16 respectively. The number of bits use to represents the pixel
values of the component images determines the bit depth of an RGB image.

For example, if each component image is an 8bit image, the corresponding


RGB image is said to be 24 bits deep.

Generally, the number of bits in all component images is the same. In this
case the number of possible colour in an RGB image is (2^b) ^3, where b is a number
of bits in each component image. For the 8bit case the number is 16,777,216 colors.

18
CHAPTER 5
SOFTWARE INTRODUCTION

Graphical user interface (GUI):


MATLAB’s Graphical User Interface Development Environment (GUIDE)
provides a rich set of tools for incorporating graphical user interfaces (GUIs) in M-
functions. Using GUIDE, the processes of laying out a GUI (i.e., its buttons, pop-up
menus, etc.) and programming the operation of the GUI are divided conveniently into
two easily managed and relatively independent tasks. The resulting graphical M-
function is composed of two identically named (ignoring extensions) files:

• A file with extension. fig, called a FIG-file that contains a complete graphical
description of all the function’s GUI objects or elements and their spatial
arrangement. A FIG-file contains binary data that does not need to be parsed when
he associated GUI-based M-function is executed.

• A file with extension .m, called a GUI M-file, which contains the code that
controls the GUI operation. This file includes functions that are called when the
GUI is launched and exited, and callback functions that are executed when a user
interacts with GUI objects for example, when a button is pushed. To launch
GUIDE from the MATLAB command window, type guide filename Where
filename is the name of an existing FIG-file on the current path. If filename is
omitted, GUIDE opens a new (i.e., blank) window.

A graphical user interface (GUI) is a graphical display in one or more


windows containing controls, called components that enable a user to perform
interactive tasks.

The user of the GUI does not have to create a script or type commands at the
command line to accomplish the tasks. Unlike coding programs to accomplish tasks,
the user of a GUI need not understand the details of how the tasks are performed.

GUI components can include menus, toolbars, push buttons, radio buttons, list
boxes, and sliders just to name a few. GUIs created using MATLAB tools can also
perform any type of computation, read and write data files, communicate with other
GUIs, and display data as tables or as plots.

5.1 Starting and Quitting MATLAB


Starting MATLAB

On a Microsoft Windows platform, to start MATLAB, double-click the MATLAB


shortcut icon on your Windows desktop.

19
On a UNIX platform, to start MATLAB, type mat lab at the operating system
prompt. After starting MATLAB, the MATLAB desktop opens - see MATLAB
Desktop.

Quitting MATLAB

To end your MATLAB session, select Exit MATLAB from the File menu in the
desktop, or type quit in the Command Window. To execute specified functions each
time MATLAB quits, such as saving the workspace, you can create and run a finish.m
script.

5.2 Desktop tools


This section provides introduction to MATLAB's desktop tools. You can also use
MATLAB functions to perform most of the features found in the desktop tools. The
tools are:

• Current Directory Browser


• Workspace Browser
• Array Editor
• Editor/Debugger
• Command Window
• Command History
• Launch Pad
Command window

Use the Command Window to enter variables and run functions and M-files.

Command history

Lines you enter in the Command Window are logged in the Command History
window. In the Command History, you can view previously used functions, and copy
and execute selected lines. To save the input and output from a MATLAB session to a
file, use the diary function.

Running external programs

You can run external programs from the MATLAB Command Window. The
exclamation point character! is a shell escape and indicates that the rest of the input
line is a command to the operating system.

This is useful for invoking utilities or running other programs without quitting
MATLAB. On Linux, for example, emacs magik.m invokes an editor called emacs for
a file named magik.m. When you quit the external program, the operating system
returns control to MATLAB.
20
Launch pad

MATLAB's Launch Pad provides easy access to tools, demos, and documentation.

Help navigator

Use to Help Navigator to find information. It includes:

Product filter - Set the filter to show documentation only for the products you
specify.

Contents tab - View the titles and tables of contents of documentation for your
products.

Index tab - Find specific index entries (selected keywords) in the MathWorks
documentation for your products.

Search tab - Look for a specific phrase in the documentation. To get help for a
specific function, set the Search type to Function Name.

Favorites tab - View a list of documents you previously designated as favorites.

Display pane

After finding documentation using the Help Navigator, view it in the display pane.
While viewing the documentation, you can:

Browse to other pages - Use the arrows at the tops and bottoms of the pages, or use
the back and forward buttons in the toolbar.

Bookmark pages - Click the Add to Favorites button in the toolbar.

Print pages - Click the print button in the toolbar.

Find a term in the page - Type a term in the Find in page field in the toolbar and
click Go.

Other features available in the display pane are: copying information, evaluating a
selection, and viewing Web pages.

Current directory browser

MATLAB file operations use the current directory and the search path as
reference points. Any file you want to run must either be in the current directory or on
the search path.

21
Search path

To determine how to execute functions you call, MATLAB uses a search path to
find M-files and other MATLAB-related files, which are organized in directories on
your file system. Any file you want to run in MATLAB must reside in the current
directory or in a directory that is on the search path. By default, the files supplied with
MATLAB and MathWorks toolboxes are included in the search path.

Workspace browser

The MATLAB workspace consists of the set of variables (named arrays) built up
during a MATLAB session and stored in memory. You add variables to the
workspace by using functions, running M-files, and loading saved workspaces.

To view the workspace and information about each variable, use the Workspace
browser, or use the functions who and whos.

To delete variables from the workspace, select the variable and select Delete from
the Edit menu. Alternatively, use the clear function.

The workspace is not maintained after you end the MATLAB session. To save the
workspace to a file that can be read during a later MATLAB session, select Save
Workspace As from the File menu, or use the save function. This saves the workspace
to a binary file called a MAT-file, which has a .mat extension. There are options for
saving to different formats. To read in a MAT-file, select Import Data from the File
menu, or use the load function.

Array editor

Double-click on a variable in the Workspace browser to see it in the Array Editor.


Use the Array Editor to view and edit a visual representation of one- or two-
dimensional numeric arrays, strings, and cell arrays of strings that are in the
workspace.

Editor/Debugger

Use the Editor/Debugger to create and debug M-files, which are programs you
write to run MATLAB functions. The Editor/Debugger provides a graphical user
interface for basic text editing, as well as for M-file debugging.

You can use any text editor to create M-files, such as Emacs, and can use
preferences (accessible from the desktop File menu) to specify that editor as the
default. If you use another editor, you can still use the MATLAB Editor/Debugger for
debugging, or you can use debugging functions, such as dbstop, which sets a
breakpoint.

22
5.3 MANIPULATING MATRICES
Entering matrices

The best way for you to get started with MATLAB is to learn how to handle
matrices. Start MATLAB and follow along with each example.

You can enter matrices into MATLAB in several different ways:

• Enter an explicit list of elements.


• Load matrices from external data files.
• Generate matrices using built-in functions.
• Create matrices with your own functions in M-files.
Start by entering Durer's matrix as a list of its elements. You have only to follow a
few basic conventions:

• Separate the elements of a row with blanks or commas.


• Use a semicolon, ; , to indicate the end of each row.
• Surround the entire list of elements with square brackets, [].
To enter Durer's matrix, simply type in the Command Window

A = [16 3 2 13; 5 10 11 8; 9 6 7 12; 4 15 14 1]

MATLAB displays the matrix you just entered.

16 3 2 13

A=5 10 11 8

9 6 7 12

4 15 14 1

This exactly matches the numbers in the engraving. Once you have entered the
matrix, it is automatically remembered in the MATLAB workspace 5.4 Expressions

Like most other programming languages, MATLAB provides mathematical


expressions, but unlike most programming languages, these expressions involve entire
matrices. The building blocks of expressions are:

• Variables
• Numbers
• Operators
• Functions

23
5.4.1 Variables

MATLAB does not require any type declarations or dimension statements. When
MATLAB encounters a new variable name, it automatically creates the variable and
allocates the appropriate amount of storage. If the variable already exists, MATLAB
changes its contents and, if necessary, allocates new storage. For example,

num_students = 25

Creates a 1-by-1 matrix named num_students and stores the value 25 in its
single element. Variable names consist of a letter, followed by any number of letters,
digits, or underscores. MATLAB uses only the first 31 characters of a variable name.
MATLAB is case sensitive; it distinguishes between uppercase and lowercase letters.
A and a are not the same variable. To view the matrix assigned to any variable, simply
enter the variable name.

5.4.2 Numbers
MATLAB uses conventional decimal notation, with an optional decimal point and
leading plus or minus sign, for numbers.

Scientific notation uses the letter e to specify a power-of-ten scale factor.


Imaginary numbers use either i or j as a suffix. Some examples of legal numbers are

3 -99 0.0001

9.6397238 1.60210e-20 6.02252e23

1i -3.14159j 3e5i

All numbers are stored internally using the long format specified by the IEEE
floating-point standard. Floating-point numbers have a finite precision of roughly 16
significant decimal digits and a finite range of roughly 10-308 to 10+308.

24
5.4.3 Operators
Expressions use familiar arithmetic operators and precedence rules

+ Addition

- Subtraction

* Multiplication

/ Division

\ Left division (described in "Matrices and Linear Algebra" in


Using MATLAB)

^ Power

' Complex conjugate transpose

() Specify evaluation order

5.4.4 Functions
MATLAB provides a large number of standard elementary mathematical functions,
including abs, sqrt, exp, and sin.

You can see the code and even modify it if you want. Several special functions
provide values of useful constants.

Pi 3.14159265...

I Imaginary unit, √-1

I Same as i

Eps Floating-point relative precision, 2-52

Realmin Smallest floating-point number, 2-1022

Realmax Largest floating-point number, (2- ε)21023

Inf Infinity

NaN Not-a-number

25
CHAPTER 6
USER INTERFACE CONTROL
The Layout Editor component palette contains the user interface controls that you
can use in your GUI. These components are MATLAB control objects and are
programmable via their Callback properties. This section provides information on
these components.

➢ Push Buttons
➢ Sliders
➢ Toggle Buttons
➢ Frames
➢ Radio Buttons
➢ List boxes
➢ Checkboxes
➢ Popup Menus
➢ Edit Text
➢ Axes
➢ Static Text
➢ Figures
6.1 Push buttons
Push buttons generate an action when pressed (e.g., an OK button may close a
dialog box and apply settings). When you click down on a push button, it appears
depressed; when you release the mouse, the button's appearance returns to its
nondepressed state; and its callback executes on the button up event.

Properties to set

String - set this property to the character string you want displayed on the push
button.

Tag - GUIDE uses the Tag property to name the callback subfunction in the
application M-file. Set Tag to a descriptive name (e.g., close_button) before activating
the GUI.

Programming the callback

When the user clicks on the push button, its callback executes. Push buttons do
not return a value or maintain a state.

26
6.2 Toggle Buttons
Toggle buttons generate an action and indicate a binary state (e.g., on or off).
When you click on a toggle button, it appears depressed and remains depressed when
you release the mouse button, at which point the callback executes.

From the GUIDE application M-File

The following code illustrates how to program the call back in the GUIDE application
M-file.

function varargout = togglebutton1_Callback(h,eventdata,handles,varargin)

button_state = get(h,'Value');

if button_state == get(h,'Max')

% toggle button is pressed

elseif button_state == get(h,'Min')

% toggle button is not pressed

end

Adding an image to a push button or toggle button

Assign the CData property an m-by-n-by-3 array of RGB values that define a true
color image. For example, the array a defines 16-by-128 true color image using
random values between 0 and 1 (generated by rand).

a(:,:,1) = rand(16,128);

a(:,:,2) = rand(16,128);

a(:,:,3) = rand(16,128);

set(h,'CData',a)

6.3 Radio Buttons


Radio buttons are similar to checkboxes, but are intended to be mutually exclusive
within a group of related radio buttons. To activate a radio button, click the mouse
button on the object. The display indicates the state of the button.

27
Implementing mutually exclusive behavior

Radio buttons have two states - selected and not selected. You can query and set
the state of a radio button through its Value property:

Value = Max, button is selected.

Value = Min, button is not selected.

To make radio buttons mutually exclusive within a group, the callback for each
radio button must set the Value property to 0 on all other radio buttons in the group.
The following subfunction, when added to the application M-file, can be called by
each radio button callback.

function mutual_exclude(off)

set(off,'Value',0)

6.4 Checkboxes
Check boxes generate an action when clicked and indicate their state as checked
or not checked. The Value property indicates the state of the check box by taking on
the value of the Max or Min property (1 and 0 respectively by default):

Value = Max, box is checked.

Value = Min, box is not checked.

You can determine the current state of a check box from within its callback by
querying the state of its Value property, as illustrated in the following example:

function checkbox1_Callback(h,eventdata,handles,varargin)

if (get(h,'Value') == get(h,'Max'))

% then checkbox is checked-take approriate action

else

% checkbox is not checked-take approriate action

end

6.5 Edit text


Edit text controls are fields that enable users to enter or modify text strings. Use
edit text when you want text as input. The String property contains the text entered by
the user.To obtain the string typed by the user, get the String property in the call back.

28
function edittext1_Callback (h,eventdata, handles,varargin)

user_string = get(h,'string');

% proceed with callback...

Obtaining numeric data from an edit test component

MATLAB returns the value of the edit text String property as a character string. If
you want users to enter numeric values, you must convert the characters to numbers.
You can do this using the str2double command, which converts strings to doubles. If
the user enters non-numeric characters, str2double returns NaN.

You can use the following code in the edit text callback. It gets the value of the
String property and converts it to a double.

It then checks if the converted value is NaN, indicating the user entered a non-
numeric character (isnan) and displays an error dialog (errordlg).

function edittext1_Callback(h,eventdata,handles,varargin)

user_entry = str2double(get(h,'string'));

if isnan(user_entry)

errordlg('You must enter a numeric value’,’ Bad Input','modal')

end

% proceed with callback...

6.6 Static text


Static text controls displays lines of text. Static text is typically used to label other
controls, provide directions to the user, or indicate values associated with a slider.
Users cannot change static text interactively and there is no way to invoke the
callback routine associated with it

6.7 Frames
Frames are boxes that enclose regions of a figure window. Frames can make a
user interface easier to understand by visually grouping related controls.

Frames have no callback routines associated with them and only uicontrols can
appear within frames (axes cannot).

29
Placing components on top of frames

Frames are opaque. If you add a frame after adding components that you want to
be positioned within the frame, you need to bring forward those components. Use the
Bring to Front and Send to Back operations in the Layout menu for this purpose.

6.8 List boxes


List boxes display a list of items and enable users to select one or more items.

The String property contains the list of strings displayed in the list box. The first
item in the list has an index of 1.

The Value property contains the index into the list of strings that correspond to the
selected item. If the user selects multiple items, then Value is a vector of indices. By
default, the first item in the list is highlighted when the list box is first displayed. If
you do not want any item highlighted, then set the Value property to empty.

The ListboxTop property defines which string in the list displays as the top most
item when the list box is not large enough to display all list entries. ListboxTop is an
index into the array of strings defined by the String property and must have a value
between 1 and the number of strings. Noninteger values are fixed to the next lowest
integer

Single or multiple selection

The values of the Min and Max properties determine whether users can make
single or multiple selections:

If Max - Min > 1, then list boxes allow multiple item selection.

If Max - Min <= 1, then list boxes do not allow multiple item selection.

Selection type

List boxes differentiate between single and double clicks on an item and set the
figure Selection Type property to normal or open accordingly. See Triggering
Callback Execution for information on how to program multiple selection.

6.9 Popup menus


Popup menus open to display a list of choices when users press the arrow. The
String property contains the list of string displayed in the popup menu.

The Value property contains the index into the list of strings that correspond to the
selected item.

30
Popup menus are useful when you want to provide users with a number of
mutually exclusive choices, but do not want to take up the amount of space that a
series of radio buttons requires.

Programming the popup menu

You can program the popup menu callback to work by checking only the index of
the item selected (contained in the Value property) or you can obtain the actual string
contained in the selected item.

This callback checks the index of the selected item and uses a switch statement to take
action based on the value. If the contents of the popup menu is fixed, then you can use
this approach.

function varargout = popupmenu1_Callback(h,eventdata,handles,varargin)

val = get(h,'Value');

switch val

case 1

% The user selected the first item

case 2

% The user selected the second item

% etc.

This callback obtains the actual string selected in the popup menu. It uses the
value to index into the list of strings. This approach may be useful if your program
dynamically loads the contents of the popup menu based on user action and you need
to obtain the selected string. Note that it is necessary to convert the value returned by
the String property from a cell array to a string.

function varargout = popupmenu1_Callback(h,eventdata,handles,varargin)

val = get(h,'Value');

string_list = get(h,'String');

selected_string = string_list{val}; % convert from cell array to string

% etc.

31
Enabling or Disabling controls

You can control whether a control responds to mouse button clicks by setting the
Enable property. Controls have three states:

on - The control is operational

off - The control is disabled and its label (set by the string property) is

grayed out.

inactive - The control is disabled, but its label is not grayed out.

When a control is disabled, clicking on it with the left mouse button does not execute
its call back routine. However, the left-click causes two other call-backs routines to
execute: First the figure Window Button Down Fcn callback executes. Then the
control's Button Down Fcn callback executes. A right mouse button click on a
disabled control posts a context menu, if one is defined for that control. See the
Enable property description for more details.

6.10 Axes
Axes enable your GUI to display graphics (e.g., graphs and images). Like all
graphics objects, axes have properties that you can set to control many aspects of its
behavior and appearance. See Axes Properties for general information on axes
objects.

Axes callbacks

Axes are not uicontrol objects, but can be programmed to execute a callback when
users click a mouse button in the axes. Use the axes ButtonDownFcn property to
define the callback.

Plotting to axes in GUIs

GUIs that contain axes should ensure the Command-line accessibility option in
the Application Options dialog is set to Callback (the default). This enables you to
issue plotting commands from callbacks without explicitly specifying the target axes.

GUIs with multiple Axes

If a GUI has multiple axes, you should explicitly specify which axes you want to
target when you issue plotting commands. You can do this using the axes command
and the handles structure. For example.

32
CHAPTER 7
PROPOSED METHOD
The proposed work in this paper is about detecting and segmenting moving
objects in videos using background subtraction and segmentation algorithms. The
goal is to extract the moving objects from their background in an input image. The
method involves the following steps:

Background subtraction: This step involves subtracting the background model


from the input image to find the moving objects' information.

Morphological processing: This step involves using morphological operations


to filter out smaller regions and remove noise regions.

Object detection and segmentation: This step involves detecting and


segmenting the moving objects using thresholding and edge detection.

The proposed method is evaluated using different sample videos, and the
results show that it gives better results than conventional methods.

7.1 Benefits:

1. Accurate detection of moving objects: The proposed method uses


background subtraction and segmentation algorithms, which help in accurately
detecting moving objects in videos.

2. Reduced computation time: By detecting only the pixels belonging to


foreground objects, the proposed method reduces computation time considerably.

3. Improved feature detection: Moving object segmentation helps in detecting


various features of moving objects for further video/image processing.

4. Better results: The experiment results show that the proposed method gives
better results than conventional methods.

Overall, the proposed method can be useful in various applications such as


surveillance videos, traffic monitoring, and human motion capture.

33
7.2 Existing system

The existing work on detecting and segmenting moving objects in videos. The
existing methods include background subtraction, optical flow, and segmentation
algorithms. However, these methods have limitations such as sensitivity to noise,
missing data, and lack of a priori knowledge. The proposed method in the paper aims
to overcome these limitations and provide better results.

7.2.1 Drawbacks:

1. Sensitivity to noise: Background subtraction and optical flow methods are


sensitive to noise, which can lead to false detections.

2. Missing data: Optical flow methods can miss data in regions with low
texture or when the motion is too fast.

3. Lack of a priori knowledge: Segmentation algorithms require a priori


knowledge of the object's shape, which may not always be available.

4. Computationally expensive: Some existing methods can be computationally


expensive, especially when processing high-resolution videos.

These limitations can affect the accuracy and efficiency of the existing
methods.

34
RESULTS:

35
36
CONCLUSION

In this paper, two methods are presented for detection and segmentation of
moving objects in videos. First method is for object detection using back ground
subtraction and second method for segmentation using two approaches i.e.
thresholding and edge detection. Simulation results demonstrated that the proposed
technique can successfully extract moving objects from various sequences.
Sometimes the boundaries of the extracted object are not accurate enough to place
them in different scenes, which require a nearly perfect boundary location. The
comparison is based on the PSNR values of the sequences and shows an adequate
variation for the two methods and it is found that Background Subtraction method is
better compared to Thresholding technique.

37
SOURCE CODE:

38
39
40
REFERENCES

[1] Xiao Lijun, “Moving Object Segmentation Based on Background Subtraction and
Fuzzy Inference,” 2011 International Conference on Mechatronic Science, Electric
Engineering and Computer August 19-22, 2 011, Jilin, China.

[2] Rita Cucchiara, Costantino Grana, Massimo Piccardi , Andrea Prati, “Detecting
Moving Objects, Ghosts and Shadows in Video Streams” Massimo Piccardi is with
Department of Computer Systems, Faculty of IT, University of Technology, Sydney -
Broadway NSW 2007 – Australia

[3] Mahmoud A. Mofaddel and Walaa M. Abd-Elhafiez, “Fast and Accurate


Approaches for Image and Moving Object Segmentation”, Department of Mathemat
ics and Computer Science, Faculty of Science, Sohag University, Sohag, Egypt.

[4] Michael Teutsch and Wolfgang Kr¨uger, “Detection, Segmentation, and Tracking
of Moving Objects in UAV Videos”, 2012 IEEE Ninth International Conference on
Advanced Video and Signal-Based Surveillance.

[5] Le Sun, Ming Dai and Xiaolu Chen, “ A Simple and Fast moving object
segmentation Based on H.264 Compressed Domain Information Compressed Domain
Information,” 2012 Fourth International Conference on C omputational and
Information Sciences.

[6] Manish Khare, Swati Nigam, Rajneesh Kumar Srivastava, Ashish Khare,
“CONTOURLET TRA NSFORM BASED MOVING OBJECT SEGMENTATION”
Proceedings of 2013 IEEE Conference on Information and Communication
Technologies (ICT 2013)

[7] R. Hartley and A. Zisserman, “Multiple-View Geometry in Computer Vision”.


Cambridge University P ress, 2004.

41
42

You might also like