You are on page 1of 51

CHAPTER 1

INTRODUCTION
1.1 DOMAIN INTRODUCTION
Pattern analysis and Machine intelligence
Pattern analysis techniques began in the late 1960s and early 1970s used in
medical imaging and astronomy. An image is may defined as a two-dimensional
f(x,y), where x and y are co-ordinate, and amplitude of function f at any x and y
co-ordinates is intensity or gray scaled of image at that point i.e x and y. when x
and y of function f are all finite and discrete we say the image is a digital image.
The field of digital image processing refers to processing of digital images. Now
days, Detection of suspicious activity by video surveillances is very common. In
previous decade monitoring of video by humans those are sited in front of screen
of videos captured by either CCTV or any other cameras. Now we are going to
automate this type of monitoring the best techniques which is used by most cases
is image processing.
Pattern-of-life analysis is a method of surveillance specifically used for
documenting or understanding a subject's (or many subjects') habits. This
information can then be potentially used to predict future actions by the subject(s)
being observed. This form of observation can, and is, generally done without the
consent of the subject, with motives including but not limited to security, profit,
scientific research, regular censuses, and traffic analysis.
Unlike these specific areas of surveillance, pattern-of-life analysis is not
limited to one medium and can encompass anything in an individual's life from
their internet browsing habits, to a record of instances of choices made in order to
determine a statistical 'favorite'.

1
1.2 PROBLEM DEFINITION

The region of the possibility and information program focuses on research in


various security techniques to address problems in repeated aim detection
applications. The goal of computerized surveillance system is to support the
human operator in prospect investigation and event categorization by without
human intervention detecting the objects and analyzing their actions using
computer vision, techniques of pattern recognition and signal processing. This
review addresses more than a few advancements made in these fields' while
bringing out the detail that realizing a practical end to end surveillance system still
relics a hard job due to more than a few challenges faced in a real world situation.
With the improvement in computing technology and now inexpensively and
technically possible to adopt multi camera and multi-modal structure to gather the
requirement of well-organized surveillance system in broad range of security
applications like security guard for important buildings and surveillance in cities.

1.3 PROJECT DESCRIPTION

Video surveillance has been an energetic study area in pattern analysis and
machine intelligence, due to its vital position in helping surveillance intelligence
and law enforcement agencies to battle alongside offense and crime actions. The
objective of a visual surveillance system is to identify irregular object behaviors
and to lift alarms when such behaviors are detected. After moving objects are
detected, it is necessary to categorize them into predefined categories, so that their
movements behaviors can be suitably interpret in the background of their
identities and their connections with the surface. Therefore, object categorization
is a very important part in a complete visual surveillance system.

CHAPTER 2
2
LITERATURE SURYEY
PAPER 1 : Smart Surveillance Based on Video Summarization
Authors : Sinnu Susan Thomas, Sumana Gupta and Venkatesh
K. Subramanian
Year : 2017
In recent years, video surveillance technology hasbecome ubiquitous in
very sphere of our life. But automated video surveillance generates huge
quantities of data, which ultimately does rely upon manual inspection at some
stage. The present work aims to address this ever increasing gap between the
volumes of actual data generated and the volume that can be reasonably inspected
manually.
It is laborious and time consuming to scrutinize the salient events from the
large video databases. We introduce smart surveillance by using video
summarization for various applications. Techniques like video summarization
epitomizes the vast content of a video in a succinct manner.
They gave an overview how to use an optimal summarization framework
for surveillance videos. In addition to reduce the search time we propose to
convert content based video retrieval problem into a content based image retrieval
problem.
In addition, to reduce the search time we perform content based video
retrieval using the summarized frame that is essentially converting a video
retrieval problem to a image retrieval one. They proposed a single query by image
based video retrieval that reduces the storage space and time complexity. The
experiments on various data sets show that it is a promising approach towards the
problem of monitoring huge data. This work can be extended with the multi
camera scenario and for 3-D videos.[1]

PAPER 2 : Intelligent Video Surveillance System


Authors : Virgil Claudiu Banu, Ilona Mădălina Costea, Florin Codrut

3
Nemtanu and Iulian Bădescu Department of Telematics and
Electronics for Transport, University Politehnica of Bucharest,
Romania
Year : 2017
It presents an architecture for a perimeter security system dedicated to
ritical transport infrastructures protection, such as the airport. To counteract
human errors and low capacity of the existing security systems to provide
redundancy at certain functional levels and high availability, an innovative
security system concept was designed, able to provide redundancy at analysis and
image processing level.
By joining the latest technologies available for CCTV, perimeter
protection, virtualization and networking, the security system that underpins the
conceptual architecture, detailed further, enhances the security of the site by using
adaptive algorithms for processing data.
Motion detection is the simplest out of the three operations related to
movement, namely: detection, estimation and segmentation. Its purpose is to
identify points of image or general image regions that have moved. In this context,
being a simple operation, it means that it can be implemented smoothly
in the proposed CCTV system applications of the innovative architecture
proposed in this scientific paper.
The principle of motion estimation is to determine the movement of a pixel,
or a block of pixels between two successive images of the sequence based on
minimizing its intensity variation, called DFD or "Displaced Frame Difference".
The proposed system is highly redundant providing hardware redundancy and
software redundancy at the analysis and video processing level[2]

PAPER 3 : Super Normal Vector for Human Activity Recognition with


Depth Cameras
Authors : Xiaodong Yang, Member, IEEE, and YingLi Tian
4
Year : 2016
The advent of cost-effectiveness and easy-operation depth cameras has
facilitated a variety of visual recognition tasks including human activity
recognition. This paper presents a novel framework for recognizing human
activities from video sequences captured by depth cameras. We extend the surface
normal to polynomial by assembling local neighbouring hyper surface normal’s
from a depth sequence to jointly characterize local motion and shape information.
It is then proposed a general scheme of super normal vector (SNV) to
aggregate the low-level polynomials into a discriminative representation, which
can be viewed as a simplified version of the Fisher kernel representation.
In order to globally capture the spatial layout and temporal order, an
adaptive spatio-temporal pyramid is introduced to subdivide a depth video into a
set of space-time cells.

In the extensive experiments, the proposed approach achieves superior


performance to the state-of-the-art methods on the four public benchmark
datasets, i.e., MSRAction3D, MSRDailyActivity3D, MSRGesture3D, and
MSRActionPairs3D. RECOGNIZING human activities has been widely
applied to a number of real-world applications, e.g., human computer interaction,
surveillance event detection, content based video search and summarization,
etc.[3]

PAPER 4 : Human Action Recognition by Representing 3D Skeletons as


Points in a Lie Group
Authors : Vemulapalli, Felipe Arrate and Rama Chellappa Center for
Automation Research UMIACS, University Maryland, College
Park.

5
Year : 2014
Recently introduced cost-effective depth sensors coupled with the real-time
skeleton estimation algorithm of Shotton have generated a renewed interest in
skeleton-based human action recognition. Most of the existing skeleton-based
approaches use either the joint locations or the joint angles to represent a human
skeleton. In this paper, we propose a new skeletal representation that explicitly
models the 3D geometric relationships between various body parts using rotations
and translations in 3D space.
Since 3D rigid body motions are members of the special Euclidean group
SE(3), the proposed skeletal representation lies in the Lie group SE(3)×. . .×SE(3),
which is a curved manifold. Using the proposed representation, human actions can
be modelled as curves in this Lie group. Since classification of curves in this Lie
group is not an easy task, we map the action curves from the Lie group to its Lie
algebra, which is a vector space. We then perform classification using a
combination of dynamic time warping, Fourier temporal pyramid representation
and linear SVM.
Experimental results on three action datasets show that the proposed
representation performs better than many existing skeletal representations. The
proposed approach also outperforms various state-of-the-art skeleton-based
human action recognition approaches. The relative geometry between all pairs of
body parts is implemented. But, each action is usually characterized by the
interactions of a specific set of body parts. Hence, we are planning to explore
various strategies to automatically identify the set of body parts that differentiates
a given action from the rest[4].

PAPER 5 : Real-Time Detection of Suspicious Human Movement


Authors : Sugla Vinaayagan Rajenderana, Ka Fei, Thang
Year : 2014
Crime is everywhere and it could be argued that we are in one of the most
crime eras in human history. Crimes like theft, violence against people and
6
property damage are some of the rising crimes in university. On the other hand,
investigation is held to find the person who is responsible for the theft, only after
the crime occurred, by using existing surveillance system. It acts as ‘post-mortem’
tools. Therefore, in this paper, an appropriate algorithm for autonomous
suspicious human-movement detection from surveillance videos is proposed.
First, proposed system extract human-movement information by detecting
and tracking people in real-time using Gaussian Mixture Model (GMM).
Morphological operations aid the detection of human-movement by eliminating
noises. Features extracted from human-movement are then sent for post-
processing in order to recognise whether the detected activity is suspicious or not.
Examples of suspicious movements are loitering and hanging or looking
around in the area of interest for longer time period. The framework used for
recognising suspicious activities is called Grammar-based approach. This
approach is effective in detecting suspicious activities with serial of events for a
longer time period. By using recorded videos with people mimicking those
suspicious activities, several experiments have been performed and results
presented in this paper. The experimental results presented here demonstrate the
outstanding performance and low computational complexity.
The result from GMM is represented in grayscale where ‘white’ pixel
represents the human in the context. Although the results are inconsistent due to
illumination and errant movement, using morphological operation those unwanted
pixels are eliminated[5].

PAPER 6 : Recognizing Actions from Depth Cameras as Weakly Aligned


Multi-Part Bag-of-Poses
Authors : Lorenzo Seidenari,Vincenzo Varano, Stefano Berretti, Alberto
Del Bimbo, Pietro Pala University of Firenze
Year : 2014

7
Recently released depth cameras provide effective estimation of 3D
positions of skeletal joints in temporal sequences of depth maps. In this work, we
propose an efficient yet effective method to recognize human actions based on the
positions of joints. First, the body skeleton is decomposed in a set of kinematic
chains, and the position of each joint is expressed in a locally defined reference
system which makes the coordinates invariant to body translations and rotations.
A multi-part bag-of-poses approach is then defined, which permits the
separate alignment of body parts through a nearest-neighbor classification.
Experiments conducted on the Florence 3D Action dataset and the MSR Daily
Activity dataset show promising results. This method has been evaluated on two
datasets: the Florence 3D Action Dataset and the Microsoft (MSR) Daily Activity
3D data set. Results scored by our approach on these datasets were also compared
against those obtained by state of the art solutions. This approach has been also
evaluated through a comparative analysis.
The first investigation aims to evidence accuracies obtained by using the
different variants of our solution. In particular, in the Table we indicate our base
solution with “NBNN”, its variants adding separately time and parts as,
respectively, “NBNN+ parts” and “NBNN+ time,” and the solution which
accounts for time and parts together as “NBNN+ parts+ time”. Results obtained
on both the Florence 3D and the DailyActivity3D datasets show that the “time”
feature is as relevant as the part based modeling in improving the performance of
the NBNN base approach; both cues combined together yield state of the art
results[6].
PAPER 7 : Surveillance Videos Suspicious Human Activity Detection from
Surveillance videos

Authors : Gowsikhaa D,Manjunath and Abirami S,Department of


information science and technology, Anna University,
Chennai, Tamilnadu
Year : 2012
8
Video analytics is the method of processing a video, gathering data and
analysing the data for getting domain specific information. In the current trend,
besides analysing any video for information retrieval, analysing live surveillance
videos for detecting activities that take place in its coverage area has become more
important. Such systems will be implemented real time. Automated face
recognition from surveillance videos becomes easier while using a training model
such as Artificial Neural Network. Hand detection is assisted by skin color
estimation.
This research work aims to detect suspicious activities such as object
exchange, entry of a new person, peeping into other’s answer sheet and person
exchange from the video captured by a surveillance camera during examinations.
This requires the process of face recognition, hand recognition and detecting the
contact between the face and hands of the same person and that among different
persons. Automation of ‘suspicious activity detection’ will help decrease error
rate due to manual monitoring.
Background estimation and foreground extraction are done and Artificial
Neural Networks are used to detect human faces. The result is then used to identify
head motion.Further a combination of Motion Detection, Edge Detection and Skin
Color Detection is performed to identify the hands of students. The major form of
contact between students during examinations is through gestures through eyes
gestures through hands and hand contact for object exchange[7].
PAPER 8 : Real-Time Human Pose Recognition in Parts from Single Depth
Images
Authors : Jamie Shotton, Toby Sharp, Alex Kipman, Andrew Fitzgibbon,
Mark Finocchio, Andrew Blake, Mat Cook, and Richard Moore
Year : 2013

A new method to quickly and accurately predict human pose—the 3D


positions of body joints—from a single depth image, without depending on
information from preceding frames was implemented. Our approach is strongly
9
rooted in current object recognition strategies. By designing an intermediate
Representation in terms of body parts, the difficult pose estimation problem is
transformed into a simpler per-pixel classification problem, for which efficient
machine learning techniques exist. By using computer graphics to synthesize a
very large dataset of training image pairs, one can train a classifier that estimates
body part labels from test images invariant to pose, body shape, clothing, and other
irrelevances.
Finally, we generate confidence-scored 3D proposals of several body joints
by reprojecting the classification result and finding local modes. It is discovered
how accurate proposals for the 3D locations of body joints can be estimated in
super real-time from single depth images. We introduced body part recognition as
an intermediate representation for human pose estimation. Use of a highly varied
synthetic training set allowed us to train very deep decision forests using simple
depth- invariant features without over fitting, learning invariance to both pose and
shape. Detecting modes in a density function gives the final set of confidence-
weighted 3D joint proposals[8].

PAPER 9 : Video surveillance systems


Authors : Ľuboš Ovseník, Anna Kažimírová Kolesárová, Ján Turán
Year : 2010
The surveillance system implemented can be viewed as four
independent, but interacting modules: detection, tracking, classification
and recognition.To
perform the detection task, a robust real-time algorithm, suggested by T.
Boult [8] was adapted. The approach followed uses two adaptive

10
background images, per-pixel adaptive thresholds and a region grouping
algorithm, named quasi-connected components (QCC). The tracking
algorithm determines the overlap
between detected regions in consecutive frames, in order to link them,
when no ambiguity exists.
The linking of an active region in consecutive frames originates a
stroke, which describes the evolution of the mass centre over time. The
classification task is performed each frame for all active regions detected,
and the classification of a stroke is performed by determining the most
voted class. To cope with tracking ambiguities, a colour-based recognition
module is also integrated in the system
The problem of remote surveillance has received growing attention in
recent years, especially in the context of public infrastructure monitoring for
transport applications, safety of quality control in industrial applications, and
improved public security. The development of a surveillance system requires
multidisciplinary expertise, including knowledge of signal and image processing,
computer vision, communications and networking pattern recognition and sensor
development and fusion[9].

PAPER 10 : A survey on vision-based human action recognition


Authors : Ronald Poppe
Year : 2010

The task of labeling videos containing human motion with action classes.
The interest in the topic is motivated by the promise of many applications, both
offline and online. Automatic annotation of video enables more efficient
11
searching, for example finding tackles in soccer matches, handshakes in news
footage or typical dance moves in music videos. Online processing allows for
automatic surveillance, for example in shopping malls, but also in smart homes
for the elderly to support aging in place. Interactive applications, for example in
human–computer interaction or games, also benefit from the advances in
automatic human action recognition.
Related is the issue of labeling data. For increasingly large and complex
datasets, manual labeling will become prohibitive. Automatic labeling using video
subtitles and movie scripts is possible in some domains, but still requires manual
verification. When using an incremental approach to image harvesting such as in,
the initial set will largely affect the final variety of action performances. We
discussed vision-based human action recognition in this survey but a multi-modal
approach could improve recognition in some domains, for example in movie
analysis. Also, context such as background, camera motion, interaction between
persons and person identity provides informative cues. Given the current state of
the art and motivated by the broad range of applications that can benefit from
robust human action recognition, it is expected that many of these challenges will
be addressed in the near future.
This would be a big step towards the fulfillment of the longstanding
promise to achieve robust automatic recognition and interpretation of human
action[10].

CHAPTER 3
SYSTEM ANALYSIS

3.1 EXISTING SYSTEM

The problem of detecting the face and recognizing them was studied by
many researchers working in the field of Computer vision and assistive

12
technologies for blind people. Most of the previous proposal uses image
processing to detect the presence of different faces in the camera frame and
perform image processing to match the detected faces against the face database to
recognize it.
The major limitations of some of the previously proposed approaches is
their capability on a low-portability computation device for the necessary image
processing which requires at least a computer with good amount of speed and yet
some others are lacking the universal design principle by limiting their training
data to a specific set and not able to add new datasets making it a static application
which could recognize only the existing faces.
These approaches also require the user to take a picture or make a video
recording at the faces and then process it to recognize them, although the picture
taken by user may not be able to capture the image with any device.

3.1.1 Limitations of Existing system

➢ The system can only monitor a limited area.


➢ The user cannot able to receive any audio message about the
suspicious person.
➢ It just records the person’s movement or action .It can be used only
for studying the human behaviours.

3.2 PROPOSED SYSTEM

The main objective is to provide a indoor security using the CCTV


camera.The CCTV Camera is a video camera that feeds or streams its image in
real time; They provide the feature of providing high security by detecting the
anonymous behaviors automatically. The Background subtraction provide the
following features:
13
✓ Reduce problem set for further processing
▪ Only process part of picture that contains the relevant information
✓ Segment the image into foreground and background
✓ Add a virtual background
The system will detect suspicious person i.e. unauthorized entry in a restricted
place in a video by using AMD algorithm and will start tracking once the user has
specified a suspicious person by his/her on the display.
The main purpose of background subtraction is to generate a reliable
background model and thus significantly improve the detection of moving objects.
Human movement is a wider term that covers a lot of categories of activities,
which require is relatively old and challenging. Hence, a lot research different
means of detection.
When compared with other field of research in computer vision, the field
of action and activity recognition and representation has been done to the
numerous type of human movement. There are many researchers researched about
human behaviour in different perspectives.
To distinguish activities of interest with normal activity, normal human
movement is recorded to be tested. Effectiveness of a system also depends on
accuracy of the recognising human-movement. Wrongly recognised movement
will gives a poor framework. Hence, experiment is done to test the system whether
can recognise normal human movement without giving any alert.
The detection of suspicious human movement is challenging due to several
reasons. First, most activities of interest are of high complexity, which becomes
an issue in the clutter scene. Another issue is the inadequacy of professional and
challenging high-quality data sets currently available for testing. These issues lead
to inconsistencies among the experimental results in different papers in literature.
In order to rectify those challenges, first, scene for the experiment is selected to
be invariant to the parameters such as lightings. The scene should resemble the
exact walkway with wide area so that this system has adequate information to

14
detect those activities classified in it.
Then, few videos are collected where persons are acted those selected
activities of interest. The video collected is limited at the rate of 5 frames per
second (fps) due to less memory. Other researchers suggested video with 1fps has
the advantage in effectively human movement due to errant movement of human
locomotion
Advanced Motion Detection (AMD) achieves complete detection of
moving objects. A camera is been connected inside the monitoring room which
produces alert messages on the account of any suspicious activity.

3.2.1 Advantages of Proposed system

➢ The system will detect suspicious person with greater accuracy.


➢ Starts tracking once the user have specified a suspicious person by
his/her on the display.
➢ Automating Suspicious activity detection will help decrease error
rate and to reduce the human power in various situations.
➢ It produces alert message through email inorder to provide remote
security features.
➢ The system recognizes the unauthorized user entry over a particular
private area that is provided by the authorized users.
➢ There is no need for the usage of the recorded videos for a particular
time;because the system work on the basis of online real-time
surveillance process.
3.3 FEASIBILITY STUDY

Technical Feasibility

The technical feasibility assessment is focused on gaining an understanding


of the present technical resources of the organization and their applicability to the

15
expected needs of the proposed system. It is an evaluation of the hardware and
software and how it meets the need of the proposed system.

Operational Feasibility

Operational feasibility is a measure of how well a proposed system solves


the problems, and takes advantage of the opportunities identified during scope
definition and how it satisfies the requirements identified in the requirements
analysis phase of system development.

The operational feasibility assessment focuses on the degree to which the


proposed development projects fits in with the existing business environment and
objectives with regard to development schedule, delivery date, corporate culture,
and existing business processes.

Economic Feasibility

The purpose of the economic feasibility assessment is to determine the


positive economic benefits to the organization that the proposed system will
provide. It includes quantification and identification of all the benefits expected.
This assessment typically involves a cost/ benefits analysis.

CHAPTER 4
SYSTEM DESIGN

4.1. ARCHITECTURE DIAGRAM

16
Fig 4.1 Architecture Diagram

4.2 UML DIAGRAMS


4.2.1 Use Case Diagrams

A Use Case describes a sequence of actions that provide something of


measurable value to an actor and is drawn as a horizontal ellipse.

17
Fig 4.2 Use case Diagram

4.2.2 Class Diagram

Class diagram represents the object orientation of a system. A class diagram


is drawn as rectangle box with three compartments or components separated by

18
horizontal lines. The top compartment holds the class name and middle
compartment holds the attribute and bottom compartment holds list of operations.

Fig 4.3 Class Diagram

4.2.3 Activity Diagram

An activity diagram is a variation or special case of a state machine in


which the states or activity representing the performance of operation and
transitions are triggered by the completion of operation.
19
Fig 4.4 Activity Diagram

4.2.4 Sequence Diagram

A sequence diagram shows an interaction arranged in time sequence. It


shows object participating in interaction by the message they exchange arranged

20
in time sequence. Vertical dimension represent time and horizontal dimension
represent object.

Fig 4.5 Sequence Diagram

CHAPTER 5
SYSTEM REQUIREMENTS

5.1 INTRODUCTION

21
5.2 HARDWARE REQUIREMENTS

The hardware requirements may serve as the basis for a contract for the
implementation of the system and should therefore be a complete and consistent
specification of the whole system. They are used by software engineers as the
starting point for the system design. It shows what the systems do and not how it
should be implemented.

Device : CCTV Camera


Processor : PENTIUM IV 2.6 GHz, Intel Core 2 Duo.
RAM : 512 MB DD RAM
Monitor : 15” Color
Hard Disk : 40 GB
5.2 SOFTWARE REQUIREMENTS

The software requirements document is the specification of the system. It


should include both a definition and a specification of requirements. The software
requirements provide a basis for creating the software requirements specification.

Front- End : JAVA SWING.


Back- End : MY SQL 5.5
Operating System : Windows 07 & above
IDE : Eclipse

CHAPTER 6
SYSTEM IMPLEMENTATION

6.1 SOFTWARE DESCRIPTION

6.1.1 JAVA

22
Java is a programming language originally developed by James Gosling at
Sun Microsystems and released in 1995 as a core component of Sun
Microsystems' Java platform. The language derives much of its syntax from C and
C++ but has a simpler object model and fewer low-level facilities. Java
applications are typically compiled to byte code that can run on any Java Virtual
Machine (JVM) regardless of computer architecture. Java is general-purpose,
concurrent, class-based, and object-oriented, and is specifically designed to have
as few implementation dependencies as possible. It is intended to let application
developers "write once, run anywhere".
Java is considered by many as one of the most influential programming
languages of the 20th century, and is widely used from application software to
web applications. The java framework is a new platform independent that
simplifies application development internet. Java technology's versatility,
efficiency, platform portability, and security make it the ideal technology for
network computing. From laptops to datacenters, game consoles to scientific
supercomputers, cell phones to the Internet, Java is everywhere!

The Java Platform

A platform is the hardware or software environment in which a program


runs. Already mentioned some of the most popular platforms like Windows 2000,
Linux, Solaris, and MacOS. Most platforms can be described as a combination of
the operating system and hardware. The Java platform differs from most other
platforms in that it’s a software-only platform that runs on top of other hardware
based platforms.
The Java platform has two components:
➢ The Java Virtual Machine (Java VM)
➢ The Java Application Programming Interface (Java API)
The Java API is a large collection of ready-made software components that
provide many useful capabilities, such as graphical user interface (GUI) widgets.

23
The Java API is grouped into libraries of related classes and interfaces; these
libraries are known as packages. The following figure depicts a program that’s
running on the Java platform.

6.1.2 MySQL Database

MySQL is a fast, easy-to-use RDBMS being used for many small and big
businesses. MySQL is developed, marketed, and supported by MySQL AB, which
is a Swedish company.

MySQL is offered fewer than two different editions: the open source
MySQL Community Server and the proprietary Enterprise Server. MySQL
Enterprise Server is differentiated by a series of proprietary extensions which
install as server plug-in, but otherwise shares the version numbering system and
is built from the same code base.

• Major features as available in MySQL 5.5:


• A broad subset of ANSI SQL 99, as well as extensions
• Cross-platform support
• Stored procedures, using a procedural language that closely adheres
to SQL/PSM
• Triggers
• Cursors

24
6.2 MODULES

1. Background modeling(BM)
2. Frame sequence
3. Object extraction (OE)
4. Action recognition
5. Constraints satisfaction
6. Human identification
7. Alarm trigger module (AT)

6.3 MODULE DESCRIPTION


1. Background Modeling (BM)

Background modeling, also known as foreground detection, is a technique


in the field so image processing and computer vision where in an image's
foreground is extracted for further processing (object recognition etc.). Generally
an image's regions of interest are objects (humans, cars, text etc.) in its
foreground. After the stage of image preprocessing (which may include image
denoising, post processing like morphology etc.) object localization is

Input videos

Segment Set Greater than


pixels Threshold Threshold
value values are
background

Ignore
background

Fig 6.1 Background modeling

25
2. Frame Sequence

The video to frame detection can be done by using so many software’s


which are available in the market today however when we are using this software
to get the frames from the video software will decide in the begin itself how many
frames we need per second so which indicates that there will be a chances of
missing the frames on which we are concentrating more, normally the number
frames per second will be different for the different cameras.

Background subtracted
video

Scene segmentation.

Extract frames from Frame sequence


video

Fig 6.2 Frame sequence

The frame extraction play the vital role in many video processing
applications like content based video retrieval, shot detection, segmentation, CC
cameras , etc the work search us concentrate on the CC Cameras which is kept in
the ON state for though out the day for recording purpose. Instead of keep it for
on state for more all the time we can place the sensor near the door and the sensor
will sense the human being who comes near the door for that movement cameras
will be on but this is not an efficient method compare to the video shot detection
techniques, here we are applying the video shot detection technique to the camera
which is associated to the indoor.

26
3. Object Extraction

A new method of video object extraction is proposed to accurately obtain


the object of interest from actively acquired videos. Traditional video object
extraction techniques often operate under the assumption of homogeneous object
motion and extract various parts of the video that are motion consistent as objects.
In contrast, the proposed active video object extraction (AVOE) paradigm
assumes that the object of interest is being actively tracked by a non-calibrated
camera under general motion and classifies the possible movements of the camera
that result in the 2D motion pattern as recovered from the image

Sequence.

Identify pixel values


Video

frames

Extract objects Recognize human


faces

Fig 6.3 Object extraction

Consequently, the AVOE(Active Video Object Extraction) method is able


to extract the single object of interest from the active video. We formalize the
AVOE process using notions from Gestalt psychology. We define a new Gestalt
factor called "shift and hold" and present 2D objects extraction algorithms.

27
4.Action Recognition

Human action recognition is an active area of research due to the wide


applications depending on it as detecting certain activities in surveillance video,
automatic video indexing and retrieval, and content based video retrieval. Action
representation can be categorized as: flow based approaches, spatio-temporal
shape template based approaches , tracking based approaches and interest points
based approaches.

In flow based approaches optical flow computation is used to describe


motion, it is sensitive to noise and cannot reveal the true motions. Spatio-temporal
shape template based a1````pproaches treat the action recognition problem as a
3D object recognition problem and extracts features from the 3D volume.

The extracted features are very huge so the computational cost is


unacceptable for real-time applications. Tracking based approaches suffer from
the same problems. Interest points based approaches have the advantage of short
feature vectors; hence low computational cost.

Event recognition is a key task in automatic understanding of video


sequences. The typical the input of the event detection, is a set of tracked groups
(keeping a consistent id through frames) detection algorithm takes as input a
video sequence and extracts interesting objects (physical objects).

Then, these objects of interest are used to model events. Finally, the events
are recognized. The abstraction stage determines which modeling techniques can
be applied.The output of the group tracker, which is having properties (such as
the intra-objects distance) and composed of detected physical objects at each
frame.

5. Constraints Satisfaction

28
The techniques used in constraint satisfaction depends on the kind of
constraints being considered to achieve the desired solution. Often used are
constraints on a finite domain, to the point that constraint satisfaction problems
are identified with problems based on constraints on a finite domain. Such
problems are usually solved via search, in particular a form of backtracking or
local search.

Fig 6.4 Constraints satisfaction

Constraint propagation are other methods used on such problems; most of


them are incomplete in general, that is, they may solve the problem or prove it
unsatisfiable, but not always. Constraint propagation methods are also used in
conjunction with search to make a given problem simpler to solve. Other
considered kinds of constraints are on real or rational numbers; solving problems
on these constraints is done via variable elimination or the simplex algorithm.

6. Human Identification

29
The face recognition problem can be divided into two main stages: face
verification (or authentication), and face identification (or recognition). The
detection stage is the first stage; it includes identifying and locating a face in an
image.
The recognition stage is the second stage; it includes feature extraction,
where important information for discrimination is saved, and the matching, where
the recognition result is given with the aid of a face database.
face recognition methods have been proposed. In the vast literature on the topic,
there are different classifications of the existing techniques. The following is one
possible high-level classification:

Fig 6.5 Human Identification

Holistic Methods: The whole face image is used as the raw input to the
recognition system. An example is the well-known PCA-based technique
introduced by Kirby and Sirovich, followed by Turk and Pentland.
Local Feature-based Methods: Local features are extracted, such as eyes, nose
and mouth. Their locations and local statistics (appearance) are the input to the
recognition stage. An example of this method is Elastic Bunch Graph Matching
(EBGM).
Although progress in face recognition has been encouraging, the task has
also turned out to be a difficult endeavor. In the following sections, we give a
brief review on technical advances and analyze technical challenges.

7. Alarm Trigger Module(AT)

30
The Alarm Trigger is primarily the alert message that is given to the
authorized users based on the situation identified in the system.When the
suspicious activity of any human is identified in the monitoring area ,based on
certain circumstances, the system produces the alert messages.
The alert message for the particular actions will be sent to the authorized
user as the mail at the real- time. These alert messages can be sent on the basis of
representation of the organization authority at the system level

Fig 6.6: Alarm Trigger Module


Once the mail is sent to the authorized user, they can make any kind of
security measures such that the crime actions can be avoided from giving any
serious issues.

CHAPTER 7

31
SYSTEM TESTING

7.1 TESTING OBJECTIVES

Testing is a set of activities that can be planned in advance and conducted


systematically. For this reason a template for software testing, a set of steps into
which we can place specific test case design techniques and testing methods
should be defined for software process. The software, which has been developed,
has to be tested to prove its validity. Testing is considered to be the least creative
phase of the whole cycle of system design. Testing often accounts for more effort
than any other software engineering activity. If it is conducted haphazardly, time
is wasted, unnecessary effort is expanded, and even worse, errors sneak through
undetected. It would therefore seem reasonable to establish a systematic strategy
for testing software.

Type of Testing

There are two type of testing according their behaviors


1. Unconventional Testing
2. Conventional Testing

Unconventional Testing

Unconventional testing is a process of verification which is doing by SQA


(Software Quality Assurance) team. It is a prevention technique which is
performing from begging to ending of the project development. In this process
SQA team verifies project development activities and insuring that developing
project is fulfilling the requirement of the client or not.

Conventional Testing

32
Conventional Testing is a process of finding the bugs and validating the
project. Testing team involves in this testing process and validating that
developed project is according to client requirement or not. This process is a
correction technique where testing team find bugs and reporting to the
development team for correction on developed project built.

7.2 TEST CASE DESIGN


7.2.1 Unit Testing

Unit testing involves the design of test cases that validate that the internal
program logic is functioning properly, and that program input produce valid
outputs. All decision branches and internal code flow should be validated. It is
the testing of individual software units of the application .it is done after the
completion of an individual unit before integration. This is a structural testing,
that relies on knowledge of its construction and is invasive. Unit tests perform
basic tests at component level and test a specific business process, application,
and/or system configuration. Unit tests ensure that each unique path of a business
process performs accurately to the documented specifications and contains
clearly defined inputs and expected results.
7.2.2 Functional Testing
Functional tests provide systematic demonstrations that functions tested
are available as specified by the business and technical requirements, system
documentation, and user manuals. Functional testing is centered on the following
items:
Valid Input : identified classes of valid input must be accepted.
Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be
exercised.
7.2.3 System Testing

33
System testing ensures that the entire integrated software system meets
requirements. It tests a configuration to ensure known and predictable results. An
example of system testing is the configuration oriented system integration test.
System testing is based on process descriptions and flows, emphasizing pre-
driven process links and integration points.

7.2.4 Acceptance Testing

User Acceptance Testing is a critical phase of any project and requires


significant participation by the end user. It also ensures that the system meets the
functional requirements.

Acceptance testing for Data Synchronization:

➢ The Acknowledgements will be received by the Sender Node after the


Packets are received by the Destination Node.
➢ The Route add operation is done only when there is a Route request in
need.
➢ The Status of Nodes information is done automatically in the Cache
Updation process.

7.3 Test Case

34
TC_ID Test Case Test Case Expected Actual Result Status
Description Result

TC-01 Register user Save the image of the It should allow It allows the user Pass
regular users and the user to to proceed
enter the valid user proceed
name

TC-02 Register user Take picture of any Error message Error message is Pass
other object than should display displayed as " No
human as "No Human Human Found "
Found"

TC-03 User Name Enter valid User It should allow It allows the user Pass
name ,it must contain the user to to proceed
only alphabets(A-Z & proceed
a-z)

TC-04 User Name Enter invalid User Error message Error message is Pass
name such as should display displayed as
alphabets with as "Please enter "Please enter valid
numbers & special valid User User name"
character name"

TC-05 Video Use the CCTV It should allow It allows the user Pass
coverage Camera for covering the user to to proceed
the area to be proceed
monitored

TC-06 Video Area to be covered is Default position Default position is Pass


coverage not specified has to be allocated
allocated

TC-07 Human Entry of authorized No Entry is set to be Pass


Identification users specification of valid
alert messages

35
TC-08 Human Entry of unauthorized Alert message Alert message will Pass
Identification users will be sent to be sent to the
the authorized authorized user
user

TC-9 Email Enter valid email id It should allow It allows the user Pass
the user to to proceed
proceed

TC-10 Email Enter invalid email Error message Error message is Pass
id should display displayed as
as "Please enter "Please enter valid
valid email id" email id"

Table 7.1 : Test Case

36
CHAPTER 8
RESULTS AND DISCUSSION

The system will detect suspicious person i.e. unauthorized entry in a


restricted place in a video by using AMD algorithm and will start tracking once
the user has specified a suspicious person by his/her on the display. In this project
measurements are made for different environments to find the strength of
algorithm.
Simple background subtraction algorithm adaptation is faster in data
validation than the modified algorithm but it gives worse results and low accuracy
with high rate of false alarms. In general, algorithms that adapt more slowly often
have better performance than those that adapt quickly. The AMD algorithm gives
better performance values than the simple algorithm.

Video motion detection is essential in numerous video surveillance


strategies. On the other hand, in open air scenes where incongruous lighting and
insignificant, yet irritating, background activities are available, it is an
unpredictable issue. In real time environment where sight is not under control
circumstance is much shoddier and loud. Light may change at whatever time
which cause framework yield less critical to manage. Late research has molded a
considerable amount of background modeling, in view of image differencing, that
reveal real-time performance and lofty accuracy for certain course of scene.
The preference of alert messages can be given based on the convenience
of the users and the related people in the authority.The alert messages can be
given in different ways such as,
• E-mail.
• Loud Speaker warnings.
• Alert message over phone.
• Alert to the local police station.

37
CHAPTER 9
CONCLUSION AND FUTURE ENHANCEMENT

9.1 CONCLUSION

The system has presented a novel module that generated an accurate


background with production of neither noise pixels nor artificial “ghost” trails.
After a high quality background model was produced, the AT module eliminated
the unnecessary examination of the entire background region and reduced the
computational complexity for the subsequent motion detection phase.
The proposed object extraction module detected the pixel of moving
objects within the triggered alarm region to from the moving object mask. It also
initiates the development of a system for suspicious human monitoring and study
of their behaviors. Finally this algorithm works for Online (Real-time) video
processing and its computational complexity is low.

9.2 FUTURE ENHANCEMENT

A robust video motion detection system has been proposed with


improved video quality analysis. The system have extended the Background and
framing method using wavelet threshold analysis and have applied it for our
quality analysis. Once the human entity is detected using the wavelet threshold
analysis, it is applied to eliminate objects other than the human entity which were
also detected in the existing threshold selection model. The analyses show that
our proposed method has a substantially higher degree of efficacy, outperforming
other methods by confusion metric accuracy rate of up to 65%.
In future, further work can be done for better distinction of objects
having aspect ratio similar to humans. Hardware and software part can also be
included where automatic alarm will be generated whenever any distinct
unauthorized entity is detected
APPENDICES

38
A.SAMPLE CODE
EigenObjectRecognizer.cs
using System;
using System.Diagnostics;
using Emgu.CV.Structure;
namespace Emgu.cv
{
public class EigenObjectRecognizer
{
private Image<Gray, Single>[] _eigenImages;
private Image<Gray, Single> _avgImage;
private Matrix<float>[] _eigenValues;
private string[] _labels;
private double _eigenDistanceThreshold;
public Image<Gray, Single>[] EigenImages
{
get { return _eigenImages; }
set { _eigenImages = value; }
}
public String[] Labels
{
get { return _labels; }
set { _labels = value; }
}
public double EigenDistanceThreshold
{
get { return _eigenDistanceThreshold; }
set { _eigenDistanceThreshold = value; }
}
public Image<Gray, Single> AverageImage
{
get { return _avgImage; }
set { _avgImage = value; }
}
public Matrix<float>[] EigenValues
{
get { return _eigenValues; }
set { _eigenValues = value; }
}
public static void CalcEigenObjects(Image<Gray, Byte>[] trainingImages, ref
MCvTermCriteria termCrit, out Image<Gray, Single>[] eigenImages, out Image<Gray,
Single> avg)
{
int width = trainingImages[0].Width;
int height = trainingImages[0].Height;
IntPtr[] inObjs = Array.ConvertAll<Image<Gray, Byte>, IntPtr>(trainingImages,
delegate(Image<Gray, Byte> img) { return img.Ptr; });
if (termCrit.max_iter <= 0 || termCrit.max_iter > trainingImages.Length)
termCrit.max_iter = trainingImages.Length;
39
int maxEigenObjs = termCrit.max_iter;
eigenImages = new Image<Gray, float>[maxEigenObjs];
for (int i = 0; i < eigenImages.Length; i++)
eigenImages[i] = new Image<Gray, float>(width, height);
IntPtr[] eigObjs = Array.ConvertAll<Image<Gray, Single>, IntPtr>(eigenImages,
delegate(Image<Gray, Single> img) { return img.Ptr; });
avg = new Image<Gray, Single>(width, height);
CvInvoke.cvCalcEigenObjects(
inObjs,
ref termCrit,
eigObjs,
null,
avg.Ptr);
}
public static float[] EigenDecomposite(Image<Gray, Byte> src, Image<Gray, Single>[]
eigenImages, Image<Gray, Single> avg)
{
return CvInvoke.cvEigenDecomposite(
src.Ptr,
Array.ConvertAll<Image<Gray, Single>, IntPtr>(eigenImages,
delegate(Image<Gray, Single> img) { return img.Ptr; }),
avg.Ptr);
}
public Image<Gray, Byte> EigenProjection(float[] eigenValue)
{
Image<Gray, Byte> res = new Image<Gray, byte>(_avgImage.Width,
_avgImage.Height);
CvInvoke.cvEigenProjection(
Array.ConvertAll<Image<Gray, Single>, IntPtr>(_eigenImages,
delegate(Image<Gray, Single> img) { return img.Ptr; }),
eigenValue,
_avgImage.Ptr,
res.Ptr);
return res;
}
public float[] GetEigenDistances(Image<Gray, Byte> image)
{
using (Matrix<float> eigenValue = new Matrix<float>(EigenDecomposite(image,
_eigenImages, _avgImage)))
return Array.ConvertAll<Matrix<float>, float>(_eigenValues,
delegate(Matrix<float> eigenValueI)
{
return (float)CvInvoke.cvNorm(eigenValue.Ptr, eigenValueI.Ptr,
Emgu.CV.CvEnum.NORM_TYPE.CV_L2, IntPtr.Zero);
});
}
public void FindMostSimilarObject(Image<Gray, Byte> image, out int index, out float
eigenDistance, out String label)
{
float[] dist = GetEigenDistances(image);

40
index = 0;
eigenDistance = dist[0];
for (int i = 1; i < dist.Length; i++)
{
if (dist[i] < eigenDistance)
{
index = i;
eigenDistance = dist[i];
}
}
label = Labels[index];
}
public String Recognize(Image<Gray, Byte> image)
{
int index;
float eigenDistance;
String label;
FindMostSimilarObject(image, out index, out eigenDistance, out label);
return (_eigenDistanceThreshold <= 0 || eigenDistance < _eigenDistanceThreshold ) ?
_labels[index] : String.Empty;
}
}
}
MainForm.cs
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.CV.Structure;
using Emgu.CV.CvEnum;
using System.IO;
using System.Diagnostics;
namespace MultiFaceRec
{
public partial class FrmPrincipal : Form
{
Image<Bgr, Byte> currentFrame;
Capture grabber;
HaarCascade face;
HaarCascade eye;
MCvFont font = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.5d, 0.5d);
Image<Gray, byte> result, TrainedFace = null;
Image<Gray, byte> gray = null;
List<Image<Gray, byte>> trainingImages = new List<Image<Gray, byte>>();
List<string> labels= new List<string>();
List<string> NamePersons = new List<string>();
int ContTrain, NumLabels, t;
string name, names = null;

41
public FrmPrincipal()
{
InitializeComponent();
face = new HaarCascade("haarcascade_frontalface_default.xml");
try
{
string Labelsinfo = File.ReadAllText(Application.StartupPath +
"/TrainedFaces/TrainedLabels.txt");
string[] Labels = Labelsinfo.Split('%');
NumLabels = Convert.ToInt16(Labels[0]);
ContTrain = NumLabels;
string LoadFaces;
for (int tf = 1; tf < NumLabels+1; tf++)
{
LoadFaces = "face" + tf + ".bmp";
trainingImages.Add(new Image<Gray, byte>(Application.StartupPath +
"/TrainedFaces/" + LoadFaces));
labels.Add(Labels[tf]);
}
}
catch(Exception e)
{
MessageBox.Show("Nothing in binary database, please add at least a face(Simply
train the prototype with the Add Face Button).", "Triained faces load",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
private void button1_Click(object sender, EventArgs e)
{
grabber = new Capture();
grabber.QueryFrame();
Application.Idle += new EventHandler(FrameGrabber);
button1.Enabled = false;
}
private void button2_Click(object sender, System.EventArgs e)
{
try
{
ContTrain = ContTrain + 1;
gray = grabber.QueryGrayFrame().Resize(320, 240,
Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
MCvAvgComp[][] facesDetected = gray.DetectHaarCascade(
face,
1.2,
10,
mgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
new Size(20, 20));
foreach (MCvAvgComp f in facesDetected[0])
{
TrainedFace = currentFrame.Copy(f.rect).Convert<Gray, byte>();

42
break;
}
TrainedFace = result.Resize(100, 100,
Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
trainingImages.Add(TrainedFace);
labels.Add(textBox1.Text);
imageBox1.Image = TrainedFace;
File.WriteAllText(Application.StartupPath + "/TrainedFaces/TrainedLabels.txt",
trainingImages.ToArray().Length.ToString() + "%");
for (int i = 1; i < trainingImages.ToArray().Length + 1; i++)
{
trainingImages.ToArray()[i - 1].Save(Application.StartupPath +
"/TrainedFaces/face" + i + ".bmp");
File.AppendAllText(Application.StartupPath +
"/TrainedFaces/TrainedLabels.txt", labels.ToArray()[i - 1] + "%");
}
MessageBox.Show(textBox1.Text + "´s face detected and added :)", "Training
OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch
{
MessageBox.Show("Enable the face detection first", "Training Fail",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
} void FrameGrabber(object sender, EventArgs e)
{
label3.Text = "0";
NamePersons.Add("");
currentFrame = grabber.QueryFrame().Resize(320, 240,
Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
gray = currentFrame.Convert<Gray, Byte>();
MCvAvgComp[][] facesDetected = gray.DetectHaarCascade(
face,
1.2,
10,
Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
new Size(20, 20));
foreach (MCvAvgComp f in facesDetected[0])
{
t = t + 1;
result = currentFrame.Copy(f.rect).Convert<Gray, byte>().Resize(100, 100,
Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
currentFrame.Draw(f.rect, new Bgr(Color.Red), 2);
if (trainingImages.ToArray().Length != 0)
{
MCvTermCriteria termCrit = new MCvTermCriteria(ContTrain, 0.001);
EigenObjectRecognizer recognizer = new EigenObjectRecognizer(
trainingImages.ToArray(),
labels.ToArray(),
3000,

43
ref termCrit);
name = recognizer.Recognize(result);
currentFrame.Draw(name, ref font, new Point(f.rect.X - 2, f.rect.Y - 2), new
Bgr(Color.LightGreen));
}
NamePersons[t-1] = name;
NamePersons.Add("");
label3.Text = facesDetected[0].Length.ToString();
gray.ROI = f.rect;
MCvAvgComp[][] eyesDetected = gray.DetectHaarCascade(
eye,
1.1,
10,
Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
new Size(20, 20));
gray.ROI = Rectangle.Empty;
foreach (MCvAvgComp ey in eyesDetected[0])
{
Rectangle eyeRect = ey.rect;
eyeRect.Offset(f.rect.X, f.rect.Y);
currentFrame.Draw(eyeRect, new Bgr(Color.Blue), 2);
}
}
t = 0;
for (int nnn = 0; nnn < facesDetected[0].Length; nnn++)
{
names = names + NamePersons[nnn] + ", ";
}
imageBoxFrameGrabber.Image = currentFrame;
label4.Text = names;
names = "";
NamePersons.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Process.Start("Donate.html");
}
}
}

MainForm.Designer.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace MultiFaceRec
{
static class Program
{

44
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmPrincipal());
}
}
}

package face_recog;

/**
*
* @author java
*/
import java.awt.AlphaComposite;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;
import org.bytedeco.javacpp.opencv_core.IplImage;
import static org.bytedeco.javacpp.opencv_core.IplImage;
import static org.bytedeco.javacpp.opencv_core.cvFlip;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvSaveImage;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvSaveImage;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvSaveImage;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvSaveImage;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvSaveImage;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvSaveImage;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvSaveImage;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvSaveImage;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvSaveImage;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvSaveImage;
import org.bytedeco.javacv.*;
import persistence.DatabaseConnection;

45
/**
* Created by gtiwari on 1/3/2017.
*/

public class Test1 implements Runnable {


final int INTERVAL = 1000;///you may use interval
CanvasFrame canvas = new CanvasFrame("Web Cam");
public Test1() {
canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
}

public void run() {


int h=0;
FrameGrabber grabber = new OpenCVFrameGrabber(0); // 1 for next camera
OpenCVFrameConverter.ToIplImage converter = new
OpenCVFrameConverter.ToIplImage();
IplImage img;
int i = 0;
int kk=0;
try {
grabber.start();
while (true) {

Frame frame = grabber.grab();

img = converter.convert(frame);

//the grabbed frame will be flipped, re-flip to make it right


cvFlip(img, img, 1);// l-r = 90_degrees_steps_anti_clockwise

//save
cvSaveImage((i++) + "aa.jpg", img);
//imgcom q=new imgcom();
// float
d=q.com("C:\\Users\\java\\Documents\\NetBeansProjects\\try\\0aa.jpg","E:\\sample\\2.jpg");
// if(d<=20){
// System.out.println("aaaaaaaaaaaaaaaaaaaa");
// }
canvas.showImage(converter.convert(img));
Main m=new Main();

// }

// No.2
// In case the buffered image supports transparency

/* g2d = bimage.createGraphics();

46
// Transparency is created on all the filled pixels
Color transparent = new Color(0, 0, 0, 0);
g2d.setColor(transparent);
g2d.setComposite(AlphaComposite.Src);
g2d.fill(new Rectangle2D.Float(20, 20, 100, 20));
g2d.dispose();*/

canvas.showImage(converter.convert(img));
m.main("D:\\Face_Recog\\"+h+"aa.jpg");

Thread.sleep(INTERVAL);
if(h>1){
FaceDetector1 f=new FaceDetector1();
boolean val= f.image("D:\\Face_Recog\\"+h+"aa.jpg");
if(val==true){
imgcom q=new imgcom();
File f1=new File("D://trained");
int j1=numberOfFiles(f1);
int cnt=0;
for(int j=1;j<=j1;j++){
if(cnt==0){

float d=q.com("file:///D:\\trained\\"+j+".jpg","file:///D:\\buff\\1.jpg");
System.out.println(d);
if(d<=6){
/* if(j==1){
JOptionPane.showMessageDialog(null, "Divya");
}*/

/* cnt++;
strQuery="UPDATE regst SET chck='1' WHERE img='"+j+"'";
System.out.println(strQuery);
st = DatabaseConnection.getConnection().createStatement();
st.executeUpdate(strQuery);
comport c=new comport();
c.main();*/
}else{
// Test t=new Test();
// t.read("unknown");
email e=new email();
e.Send("foreview.java", "foreview334", "divya17.1179@gmail.com", "alert",
"unknown user");
}

}
}
}
}

47
h++;
kk++;
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static int countFilesInDirectory(File directory) {
int count = 0;
for (File file : directory.listFiles()) {
if (file.isFile()) {
count++;
}
if (file.isDirectory()) {
count += countFilesInDirectory(file);
}
}
return count;
}

public static void main(String[] args) {


Test1 gs = new Test1();
Thread th = new Thread(gs);
th.start();
}
public int numberOfFiles(File srcDir) {
int count = 0;
File[] listFiles = srcDir.listFiles();
for(int i = 0; i < listFiles.length; i++){
if (listFiles[i].isDirectory()) {
count += numberOfFiles(listFiles[i]);
} else if (listFiles[i].isFile()) {
count++;
}
}
return count;
}
public void paint(Graphics g) {
Graphics2D g2=(Graphics2D)g;
g2.setBackground(Color.WHITE);
g2.clearRect(0, 0, 500, 400);
g2.setColor(Color.BLACK);
g2.drawString("Draw a rectangle", 100,100);
g2.drawRect(100,200,50,50);
}

public static void saveCanvas(Canvas canvas) {

48
BufferedImage image=new BufferedImage(canvas.getWidth(),
canvas.getHeight(),BufferedImage.TYPE_INT_RGB);

Graphics2D g2=(Graphics2D)image.getGraphics();

canvas.paint(g2);
try {
ImageIO.write(image, "png", new File("D://canvas.png"));
} catch (Exception e) {

}
}
}

REFERENCES

49
[1] “Smart Surveillance Based on Video Summarization”, Sinnu Susan

Thomas, Sumana Gupta and Venkatesh K. Subramanian,2017.

[2] “Intelligent Video Surveillance System”,Virgil Claudiu Banu, Ilona

Mădălina Costea, Florin Codrut Nemtanu and Iulian Bădescu Department

of Telematics and Electronics for Transport, University Politehnica of

Bucharest, Romania,2017.

[3] “Super Normal Vector for Human Activity Recognition with Depth

Cameras”, Xiaodong Yang, Member, IEEE, and YingLi Tian, Senior

Member, IEEE

[4] R. Vemulapalli, F. Arrate, and R. Chellappa, “Human Action Recognition

by Representing 3D Skeletons as Points in a Lie Group”, CVPR, 2014.

[5] “Real-Time Detection of Suspicious Human Movement”,Sugla

Vinaayagan

Rajenderana, Ka Fei, Thang, 2014.

[6] L. Seidenari, V. Varano, S. Berretti, A. Bimbo, and P. Pala, “Recognizing

Actions from Depth Cameras as Weakly Aligned Multi-Part Bag-of-

Poses”, CVPR Workshop on Human Activity Understanding from 3D

Data, 2013.

50
[7] “Surveillance Videos Suspicious Human Activity Detection from

Surveillance videos”,Gowsikhaa D,Manjunath and Abirami S, Department

of information science and technology, Anna University,

Chennai, Tamilnadu,2012.

[8] J. Shotton, A. Fitzgibbon, M. Cook, T. Sharp, M. Finocchio, R.Moore, A.

Kipman, and A. Blake, “Real-Time Pose Recognition in Parts from Single

Depth Images”, CVPR, 2011.

[9] “Video surveillance systems”,Ľuboš Ovseník, Anna Kažimírová

Kolesárová, Ján Turán, 2010

[10] R. Poppe, “A Survey on Vision based Human Action Recognition”,

Image and Vision Computing, 2010.

[11] https://www.sciencedirect.com/science/article/pii/S1665642314716323

[12] https://ieeexplore.ieee.org/document/7732378/?reload=true

[13] https://www.videosurveillance.com/apps/

[14] https://www.biorxiv.org/content/early/2017/07/18/165266

[15] https://www.springer.com/in/book/9780792379744

51

You might also like