KEMBAR78
Criminal Detection | PDF | My Sql | Relational Database
0% found this document useful (0 votes)
16 views133 pages

Criminal Detection

The document presents a project on an AI Facial Recognition Criminal Identification System developed by Sadaf Khan as part of her Master's degree at SRM Institute of Science and Technology. The system aims to enhance criminal identification by automating the recognition of faces captured by CCTV, comparing them against a database of known criminals, and achieving over 80% accuracy. The project includes an analysis of existing systems, proposed improvements, and a feasibility study confirming the technical, economic, and operational viability of the new system.

Uploaded by

Saim Keshri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views133 pages

Criminal Detection

The document presents a project on an AI Facial Recognition Criminal Identification System developed by Sadaf Khan as part of her Master's degree at SRM Institute of Science and Technology. The system aims to enhance criminal identification by automating the recognition of faces captured by CCTV, comparing them against a database of known criminals, and achieving over 80% accuracy. The project includes an analysis of existing systems, proposed improvements, and a feasibility study confirming the technical, economic, and operational viability of the new system.

Uploaded by

Saim Keshri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 133

Project on AI Facial Recognition Criminal

Identification System
Submitted by

SADAF KHAN
[EA2332251010555]

Under the Guidance of


Dr.G.Babu
(Assistant Professor, Directorate of Online Education)
in partial fulfillment for the award of the degree of

MASTER OF COMPUTER APPLICATIONS

DIRECTORATE OF ONLINE
EDUCATION SRM INSTITUTE OF SCIENCE
AND TECHNOLOGY
KATTANKULATHUR
BONAFIDE CERTIFICATE

This is to certify that 1, SADAF KHAN(EA2332251010555),


a student of Master of Computer Applications (MCA) in the
Department of Computer Applications, at SRM Institute of
Science and Technology, Chennai, have successfully completed
the project titled " Project on AI Facial Recognition Criminal
Identification System " as part of the curriculum requirement for
the partial full-fillment of the degree.
I declare that this project report is the outcome of my own efforts
carried out under the guidance of my internal faculty supervisor.
To the best of my knowledge, this work has not been submitted
previously for the award of any degree or diploma to
any other university or institution.

SADAF KHAN

Signature of the Student


ABSTRACT
We all know that our Face is a unique and crucial part of the
human body structure that identifies a person. Therefore, we can
use it to trace the identity of a criminal person. With the
advancement in technology, we are placed CCTV at many public
places to capture the criminal's crime. Using the previously
captured faces and criminal's images that are available in the
police station, the criminal face recognition system of can be
implemented. In this paper, we propose an automatic criminal
identification system for Police Department to enhance and
upgrade the criminal distinguishing into a more effective and
efficient approach. Using technology, this idea will add plus point
in the current system while bringing criminals spotting to a whole
new level by automating tasks. Technology working behind it will
be face recognition, from the footage captured by the CCTV
cameras; our system will detect the face and recognize the
criminal who is coming to that public place. The captured images
of the person coming to that public place get compared with the
criminal data we have in our database. If any person's face from
public place matches, the system will display their image on the
system screen and will give the message with their name that the
criminal is found and present in this public place. This system
matching more than 80% of the captured images with database
images
ACKNOWLEDGEMENTS

We express our humble gratitude to Dr C.


Muthamizhchelvan, Vice- Chancellor, SRM Institute of
Science and Technology, for the facilities extended for the
project work and his continued support. We extend our
sincere thanks to Director DOE, SRM Institute of Science
and Technology, Prof. Dr Manoranjan Pon Ram, for his
invaluable support. SRM Institute of Science and
Technology, for her support throughout the project work.
We want to convey our thanks to Programme Coordinator
Dr. G. Babu, Directorate of online Education, SRM Institute
of Science and Technology, for their inputs during the
project reviews and support. Our inexpressible respect and
thanks to my guide, Dr G.Babu., Assistant Professor &
Programme Coordinator Directorate of online Education,,
SRM Institute of Science and Technology, for providing me
with an opportunity to pursue my project under her
mentorship. She provided me with the freedom and
support to explore the research topics of my interest. Her
passion for solving problems and making a difference in the
world has always been inspiring. We sincerely thank the
Directorate of online Education, staff and students, SRM
Institute of Science and Technology, for their help during
our project. Finally, we would like to thank parents, family
members, and friends for their unconditional love,
constant support, and encouragement.

SADAF KHAN
CONTENTS
*Acknowledgement

*Abstract

1. INTRODUCTION
1.1 Organization Profile
1.2 Face Identification

2. SYSTEM ANALYSIS
2.1 Existing System
2.2 Proposed System
2.3 Feasibility Study

3. MODULE DESCRIPTION
3.1 Add Image
3.2 Construct Image
3.3 Identification
3.4 Sample
3.5 Training
4. SYSTEM REQUIREMENTS
4.1 Software Requirements
4.2 Hardware Requirements

5. OVERVIEW OF PYTHON
6. MYSQL – INTRODUCTION

7. SYSTEM DESIGN
5.1 Detailed Design
5.1.1 UML Diagrams
5.2 Database Design
5.2.1 Dataflow Diagrams
5.2.2 Database Tables
5.2.3 Screens.

8. TESTING
9. IMPLEMENTATION
10. CONCLUSION
11. BIBLIOGRAPHY
INTRODUCTION

Face recognition is one of the few biometric methods that possess the
merits of both accuracy and low intrusiveness.For this reason since the
early 70s, face recognition has drawn the attention of researchers in
fields from security and image processing to computer vision. Face
recognition has also proven useful in multimedia information
processing areas. Face recognition is the task of identifying an already
detected object as a known or unknown face. Often the problem of
face recognition is confused with the problem of face detection. On the
other hand is to decide if the face is someone known, or unknown,
using for this purpose a database of faces in order to validate this input
face. This project main objective is to create an efficient architecture
for face recognition in playing videos using Neural Network. This
product which two self contained Neural Network (CNNs) which are
used to detect and recognize faces in regions containing a dense
grouping of features from Accelerated Segment Test (FAST).
Determining if the image of the face of any given person matches any
of the face images stored in a database. This problem is hard to solve
automatically due to the changes that various factors, such as facial
expression, aging and even lighting, can cause on the image. Among the
different biometric techniques facial recognition may not be the most
reliable but it has several advantages over the others[2].It is widely
used in various areas such as security and access control, forensic
medicine, police controls and in attendance management system. The
various techniques for
marking person are: 1) Signature based System 2) Finger print based
System 3) Iris Recognition 4) RFID based System 5) Face Recognition
Amongst the above techniques, Face Recognition is natural, easy to use
and does not require aid from the test subject.. It is a series of several
related problems which are solved step by step: 1. To capture a picture
and discern all the faces in it. 2.Concentrate on one face at a time and
understand that even if a face is turned in a strange direction or in bad
lighting, it is still the same person. 3. Determine various unique features
of the face that can help in distinguishing it from the face of any other
person. These characteristics could be the size eyes, nose, length of
face, skin colour, etc. 4. Compare these distinctive features of that face
to all the faces of people we already know to find out the persons
name. Our brain, as a human is made to do all of this automatically and
instantaneously. Computers are incapable of this kind of high-level
generalization, so we need to teach or program each step of face
recognition separately. Face recognition systems fall into two
categories: verification and identification. Face verificat

1. Mayuri S. Takore, Pallavi R.Wankhade, Criminal Face


Identification System February 2015

The purpose of these mentioned work is to, Indentify Criminal record


that usually contains

personal information concerning explicit person Alongside photograph.


To spot any Criminal we
need some identification related to person, that are given by viewer. In
most cases the standard

and backbone of the recorded image segments is poor and hard to


identify a face. To beat this

drawback, they tend to developed a system.

Identification can be done in various ways like finger print, eyes, DNA
etc. One in all applications

is face identification. So there main objective was to give primary focus


for attention in social

intercourse taking part in significant role in conveying identify and


establishing emotion. Though

the power to infer intelligence or character from facial look is suspect,


the human ability to

acknowledge face is outstanding.

2. Nurul Azma Abdullah, Md. Jamri Saidi, Nurul Hidayah Ab


Rahman, Chuah ChaiWen, and

Isredza Rahmi A. Hamid, Face recognition for criminal identification

Associate Degree implementation of principal component analysis for


face recognition, The

second International Conference on Applied Science and Technology


2017 In this paper, an

automatic face recognition system for criminal info was proposed using
known Principal
Component Analysis approach. And there implementation of this
techniques are going to be ready

to discover face and recognize face automatically. From that system


they can facilitate the law

enforcements to detect or recognize suspect of the case if no


thumbprint present on the scene.

3. E-CRIME DETECTION Using FACE RECOGNITION SYSTEM 8616 Volume


three, Issue 2

April 2014.

In this Proposed system they spotted criminals at numerous security


places like airdrome,shipping

yards, railways etc. There implemented video camera captures a hard


and fast range of frames of

a person coming in front of sign on counter. And it compares these


captured pictures taken through.

INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING AND

APPLICATIONS

VOLUME XV, ISSUE VI, JUNE 21, WWW.IJCEA.COM ISSN 2321-3469

124

the camera with the pictures of the Criminals which are stored in the
database. There system has

connection of two stages Face detection using Hear Based Cascade


classifier and recognition using
Principle Component analysis with Eigen Face. The goal of there system
is to implement the

system (model) for a selected face and distinguish it from an oversized


range of stored faces with

some period of time variations as well.

4. Prarthana Sandip Patil, Pournima Paman Patel, Snehal Prakash Sonar,


Chaudhari Vrushali

Kishor, Crime Identification using 3-D Face Recognition, International


Journal of Emerging

Technologies in Engineering Research, 2018.

The objective of this journal paper is to assess confront discovery and


acknowledgmentprocedures

and provides a complete image based mostly face location and


acknowledgment with higher truth,

higher reaction rate associated an underlying advance for video


observation. They proposed a

system such as there arrangement is planned in light of performed tests


on totally different face

made databases as so much as subjects, stance, feelings and light.

5. Ashutosh Chandra Bhensle, Rohit Raja, An Efficient Face Recognition


using PCA and

Euclidean Distance Classification, IJCSMC, 2014.


They stated that, the Person identification using face is incredibly
exigent and knotty drawback.

So recognition of a person from an arbitrary perspective is crucial


necessities for security measures

and access management. Recognition of a specific face may be useful


for countless issues like

person laptop interaction, criminal detection, etc. The present system


has additional calculation

because of higher dimensional and no more effectual still. Rather than


feat of face vectors with

high speciality it is higher to use face vectors with lower speciality.


This en- forced face

recognition system is easy and comparatively simple to recognize the


faces from videos taken from

a distance and web cams. They implemented improved PCA rule that
removes facial expressions

and classification that are performed by minimum distance


classification.

INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING AND

APPLICATIONS

VOLUME XV, ISSUE VI, JUNE 21, WWW.IJCEA.COM ISSN 2321-3469

126
physical and chemical processing techniques and saved as the
database. This images collected

from the crime scene are usually incomplete and hence difficult to
categorize. So they

Implemented suitable enhancement methods that required for pre-


processing the fingerprint

images. Trivial details are extracted from the fingerprint images. The
features of preprocessed data

are fed into the CNN as input to train and test the network. So there
experimental results

demonstrated on database using Open CV-Python showed high


accuracy of 80% recognition and

partial or full fingerprints in the criminal database .


SYSTEM ANALYSIS EXISTING
SYSTEM

The development of face identification has been past from the year to
years. In recent years to identify any student face they used to make a
sketch or draw a image based on the eyewitnesses. It used to take more
amount of time and it was very difficult task for any investigation
department to easily catch the students within a stipulated time. In order
to catch the students first they used to search their record whether to find
out is there any record about that particular person in the past. In olden
days each and every record was maintained in the books or registers or
files which used to contain information about previous students with
their names, alias name, gender, age, crime involved, etc. Here each and
every task used to take the help of the person because they used to write
in them and it needed very much of manual effort.

There are three major research groups, which propose three different
approaches to the face recognition problem. The largest group has dealt
with facial characteristics. The second group performs human face
identification based on feature vectors extracted from profile silhouettes.
The third group uses feature vectors extracted from a frontal view of the
face. The first method is based on the information theory concepts in
other words on the principal component analysis methods. In this
approach, the most relevant information that best describes a face is
derived from the entire face image. The second method is based on
extracting feature vectors from the basic parts of a face such as eyes,
nose, mouth and chin.
DRAWBACKS IN EXISTING SYSTEM:

 Need of extra manual effort.


 It used to take much time to find any students
 Not very much accurate.
 Danger of losing the files in some cases.
 Need Good Knowledge in drawing.

PROPOSED SYSTEM

To overcome the drawbacks that were in the existing system we develop


a system that will be very useful for any investigation department. Here
the program keeps track of the record number of each slice during the
construction of identifiable human face andcalculate maximum number
of slices of the similar record number. Based on this record number the
program retrieves the personal record of the student (whose slice
constituted the major parts of the constructed human face) on exercising
the “locate” option.

ADVANTAGES OF PROPOSED SYSTEM:


 Very fast and accurate.
 No need of any extra manual effort.
 No fever of data loss.
 Just need a little knowledge to operate the system.
 Doesn’t require any extra hardware device.
 At last, very easy to find the students.

OVERVIEW OF THE PROPOSED SYSTEM:

 Addition, Clipping, Construction and updating of the student


record and face.
 Comparing the image with the faces that are there in our database.
 If any new images are found then it should be entered into our
database by add image module and then it should be segmented
into different slices.

FEASIBILITY STUDY

Once the problem is clearly understood, the next step


is to conduct feasibility study, which is high-level capsule version of the
entered systems and design process. The objective is to determine
whether or not the proposed system is feasible. The three tests of
feasibility have been carried out.
 Technical Feasibility
 Economic Feasibility
 Operational Feasibility

 TECHNICAL FEASIBILITY
In Technical Feasibility study, one has to test
Whether the proposed system can be developed using existing
technology or not. It is planned to implement the proposed system using
java technology. It is evident that the necessary hardware and software
are available for development and implementation of the proposed
system. Hence, the solution is technically feasible.

 ECONOMICAL FEASIBILITY

As part of this, the costs and benefits associated


With the proposed system compared and the project is economically
feasible only if tangible or intangible benefits outweigh costs. The
system development costs will be significant. So the proposed system is
economically feasible.

 OPERATIONAL FEASIBILITY
It is a standard that ensures interoperability
Without stifling competition and innovation among users, to the benefit
of the public both in terms of cost and service quality. The proposed
system is acceptable to users. So the proposed system is operationally
feasible.
MODULES

 Add Image
 Clip Image
 Construct Image
 Identification

A module is a small part of our project. This plays a very important role
in the project and in coding concepts. In Software Engineering concept
we treat it has a small part of a system but whereas in our programming
language it is a small part of the program, which we also called as
function in, some cases which constitute the main program.

Importance of modules in any software development side is we can


easily understand what the system we are developing and what its main
uses are. At the time of project, we may create many modules and finally
we combine them to form a system.
ADD CRIMINAL IMAGE

Add Image is a module that is considered with adding image along


with the complete details of the person of whom we are taking image.
In this we add Image by importing from the Internet and store them in
our system and database. This module is mainly considered for
adding details of the students like name, age, alias name, gender,
location, state, Arrested Date, etc. At the time of the adding image,
we give some student id to that particular person, so that it can be
easily added to the database with any duplication of the data.

CONSTRUCT CRIMINAL IMAGE

Based on the eyewitnesses we are going to construct the images. The


witness will give us instruction by looking onto the screen on which
there will be the parts of the images like eyes, hairs etc.

IDENTIFICATION

This module contains the interface to take the image from


above module and it compares or searches with the images already
there in the database. If any image is matched then we identify
him/her as the student else we add that new image again to the
database.
SYSTEM REQUIREMENTSPECIFICATION

SOFTWARE REQUIREMENTS:

Operating System : Windows 7 and Above

Database Server : MySQL or WAMP

server Programming Language : Python

HARDWARE REQUIREMENTS:

Processor : Pentium IV

Clock Speed : 2.86GHZ Processor

Hard disk : 2GB

RAM : 256MB
OVERVIEW OF PYTHON

Python is a high-level, interpreted, interactive and object-oriented


scripting language. Python is designed to be highly readable. It uses
English keywords frequently where as other languages use punctuation,
and it has fewer syntactical constructions than other languages.
 Python is Interpreted − Python is processed at runtime by
the interpreter. You do not need to compile your program
before executing it. This is similar to PERL and PHP.
 Python is Interactive − You can actually sit at a Python
prompt and interact with the interpreter directly to write your
programs.
 Python is Object-Oriented − Python supports Object-
Oriented style or technique of programming that encapsulates
code within objects.
 Python is a Beginner's Language − Python is a great
language for the beginner-level programmers and supports
the development of a wide range of applications from simple
text processing to WWW browsers to games.
History of Python

Python was developed by Guido van Rossum in the late eighties and
early nineties at the National Research Institute for Mathematics and
Computer Science in the Netherlands.
Python is derived from many other languages, including ABC, Modula-
3, C, C++, Algol-68, Smalltalk, and Unix shell and other scripting
languages.
Python is copyrighted. Like Perl, Python source code is now available
under the GNU General Public License (GPL).
Python is now maintained by a core development team at the institute,
although Guido van Rossum still holds a vital role in directing its
progress.

Python Features
Python's features include −
 Easy-to-learn − Python has few keywords, simple structure,
and a clearly defined syntax. This allows the student to pick
up the language quickly.
 Easy-to-read − Python code is more clearly defined and
visible to the eyes.
 Easy-to-maintain − Python's source code is fairly easy-to-
maintain.
 A broad standard library − Python's bulk of the library is
very portable and cross-platform compatible on UNIX,
Windows, and Macintosh.
 Interactive Mode − Python has support for an interactive
mode which allows interactive testing and debugging of
snippets of code.
 Portable − Python can run on a wide variety of hardware
platforms and has the same interface on all platforms.
 Extendable − You can add low-level modules to the Python
interpreter. These modules enable programmers to add to or
customize their tools to be more efficient.
 Databases − Python provides interfaces to all major
commercial databases.
 GUI Programming − Python supports GUI applications that
can be created and ported to many system calls, libraries and
windows systems, such as Windows MFC, Macintosh, and
the X Window system of Unix.
 Scalable − Python provides a better structure and support for
large programs than shell scripting.
Apart from the above-mentioned features, Python has a big list of good
features, few are listed below −
 It supports functional and structured programming methods
as well as OOP.
 It can be used as a scripting language or can be compiled to
byte-code for building large applications.
 It provides very high-level dynamic data types and supports
dynamic type checking.
 It supports automatic garbage collection.
 It can be easily integrated with C, C++, COM, ActiveX,
CORBA, and Java.

Python is available on a wide variety of platforms including Linux and


Mac OS X. Let's understand how to set up our Python environment.
Local Environment Setup
Open a terminal window and type "python" to find out if it is already
installed and which version is installed.
 Unix (Solaris, Linux, FreeBSD, AIX, HP/UX, SunOS,
IRIX, etc.)
 Win 9x/NT/2000
 Macintosh (Intel, PPC, 68K)
 OS/2
 DOS (multiple versions)
 PalmOS
 Nokia mobile phones
 Windows CE
 Acorn/RISC OS
 BeOS
 Amiga
 VMS/OpenVMS
 QNX
 VxWorks
 Psion
 Python has also been ported to the Java and .NET virtual
machines

Getting Python

The most up-to-date and current source code, binaries, documentation,


news, etc., is available on the official website of
Python https://www.python.org/
You can download Python documentation
from https://www.python.org/doc/. The documentation is available in
HTML, PDF, and PostScript formats.

Installing Python

Python distribution is available for a wide variety of platforms. You


need to download only the binary code applicable for your platform and
install Python.
If the binary code for your platform is not available, you need a C
compiler to compile the source code manually. Compiling the source
code offers more flexibility in terms of choice of features that you
require in your installation.
Here is a quick overview of installing Python on various platforms –

Unix and Linux Installation

Here are the simple steps to install Python on Unix/Linux machine.


 Open a Web browser and go
to https://www.python.org/downloads/.
 Follow the link to download zipped source code available for
Unix/Linux.
 Download and extract files.
 Editing the Modules/Setup file if you want to customize some
options.
 run ./configure script
 make
 make install
This installs Python at standard location /usr/local/bin and its libraries
at /usr/local/lib/pythonXX where XX is the version of Python.

Windows Installation

Here are the steps to install Python on Windows machine.


 Open a Web browser and go
to https://www.python.org/downloads/.
 Follow the link for the Windows installer python-XYZ.msi file
where XYZ is the version you need to install.
 To use this installer python-XYZ.msi, the Windows system
must support Microsoft Installer 2.0. Save the installer file to
your local machine and then run it to find out if your machine
supports MSI.
 Run the downloaded file. This brings up the Python install
wizard, which is really easy to use. Just accept the default
settings, wait until the install is finished, and you are done.

Setting up PATH

Programs and other executable files can be in many directories, so


operating systems provide a search path that lists the directories that the
OS searches for executables.
The path is stored in an environment variable, which is a named string
maintained by the operating system. This variable contains information
available to the command shell and other programs.
The path variable is named as PATH in Unix or Path in Windows (Unix
is case sensitive; Windows is not).
In Mac OS, the installer handles the path details. To invoke the Python
interpreter from any particular directory, you must add the Python
directory to your path.

Setting path at Unix/Linux

To add the Python directory to the path for a particular session in Unix −
 In the csh shell − type setenv PATH
"$PATH:/usr/local/bin/python" and press Enter.
 In the bash shell (Linux) − type export
PATH="$PATH:/usr/local/bin/python" and press Enter.
 In the sh or ksh shell − type
PATH="$PATH:/usr/local/bin/python" and press Enter.
 Note − /usr/local/bin/python is the path of the Python
directory
Setting path at Windows
To add the Python directory to the path for a particular session in
Windows −
At the command prompt − type path %path%;C:\Python and press
Enter.
Note − C:\Python is the path of the Python directory

MySQL – Introduction

What is a Database?
A database is a separate application that stores a collection of data. Each
database has one or more distinct APIs for creating, accessing,
managing, searching and replicating the data it holds.
Other kinds of data stores can also be used, such as files on the file
system or large hash tables in memory but data fetching and writing
would not be so fast and easy with those type of systems.
Nowadays, we use relational database management systems (RDBMS)
to store and manage huge volume of data. This is called relational
database because all the data is stored into different tables and relations
are established using primary keys or other keys known as Foreign
Keys.
A Relational Database Management System (RDBMS) is a software
that −
 Enables you to implement a database with tables, columns
and indexes.
 Guarantees the Referential Integrity between rows of various
tables.
 Updates the indexes automatically.
 Interprets an SQL query and combines information from
various tables.

RDBMS Terminology

Before we proceed to explain the MySQL database system, let us revise


a few definitions related to the database.
 Database − A database is a collection of tables, with related
data.
 Table − A table is a matrix with data. A table in a database
looks like a simple spreadsheet.
 Column − One column (data element) contains data of one
and the same kind, for example the column postcode.
 Row − A row (= tuple, entry or record) is a group of related
data, for example the data of one subscription.
 Redundancy − Storing data twice, redundantly to make the
system faster.
 Primary Key − A primary key is unique. A key value cannot
occur twice in one table. With a key, you can only find one
row.
 Foreign Key − A foreign key is the linking pin between two
tables.
 Compound Key − A compound key (composite key) is a key
that consists of multiple columns, because one column is not
sufficiently unique.
 Index − An index in a database resembles an index at the
back of a book.
 Referential Integrity − Referential Integrity makes sure that
a foreign key value always points to an existing row.
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 becoming so
popular because of many good reasons −
 MySQL is released under an open-source license. So you
have nothing to pay to use it.
 MySQL is a very powerful program in its own right. It
handles a large subset of the functionality of the most
expensive and powerful database packages.
 MySQL uses a standard form of the well-known SQL data
language.
 MySQL works on many operating systems and with many
languages including PHP, PERL, C, C++, JAVA, etc.
 MySQL works very quickly and works well even with large
data sets.
 MySQL is very friendly to PHP, the most appreciated
language for web development.
 MySQL supports large databases, up to 50 million rows or
more in a table. The default file size limit for a table is 4GB,
but you can increase this (if your operating system can handle
it) to a theoretical limit of 8 million terabytes (TB).
 MySQL is customizable. The open-source GPL license
allows programmers to modify the MySQL software to fit
their own specific environments.

Before You Begin


Before you begin this tutorial, you should have a basic knowledge of the
information covered in our PHP and HTML tutorials.
This tutorial focuses heavily on using MySQL in a PHP environment.
Many examples given in this tutorial will be useful for PHP
Programmers.
All downloads for MySQL are located at MySQL Downloads. Pick
the version number of MySQL Community Server which is required
along with the platform you will be running it on.

Installing MySQL on Linux/UNIX


The recommended way to install MySQL on a Linux system is via RPM.
MySQL AB makes the following RPMs available for download on its
website −

MySQL − The MySQL database server manages the databases and


tables, controls user access and processes the SQL queries.

MySQL-client − MySQL client programs, which make it possible to


connect to and interact with the server.

MySQL-devel − Libraries and header files that come in handy when


compiling other programs that use MySQL.

MySQL-shared − Shared libraries for the MySQL client.

MySQL-bench − Benchmark and performance testing tools for the


MySQL database server.
The MySQL RPMs listed here are all built on a SuSE Linux system, but
they will usually work on other Linux variants with no difficulty.

Now, you will need to adhere to the steps given below, to proceed with
the installation −

Login to the system using the root user.

Switch to the directory containing the RPMs.

Install the MySQL database server by executing the following


command. Remember to replace the filename in italics with the file
name of your RPM.

[root@host]# rpm -i MySQL-5.0.9-0.i386.rpm


The above command takes care of installing the MySQL server, creating
a user of MySQL, creating necessary configuration and starting the
MySQL server automatically.

You can find all the MySQL related binaries in /usr/bin and /usr/sbin.
All the tables and databases will be created in the /var/lib/mysql
directory.
The following code box has an optional but recommended step to install
the remaining RPMs in the same manner −

[root@host]# rpm -i MySQL-client-5.0.9-0.i386.rpm


[root@host]# rpm -i MySQL-devel-5.0.9-0.i386.rpm
[root@host]# rpm -i MySQL-shared-5.0.9-0.i386.rpm
[root@host]# rpm -i MySQL-bench-5.0.9-0.i386.rpm
Installing MySQL on Windows
The default installation on any version of Windows is now much easier
than it used to be, as MySQL now comes neatly packaged with an
installer. Simply download the installer package, unzip it anywhere and
run the setup.exe file.

The default installer setup.exe will walk you through the trivial process
and by default will install everything under C:\mysql.

Test the server by firing it up from the command prompt the first time.
Go to the location of the MySQL server which is probably C:\mysql\bin,
and type −

mysqld.exe --console
NOTE − If you are on NT, then you will have to use mysqld-nt.exe
instead of mysqld.exe
If all went well, you will see some messages about startup and inorb. If
not, you may have a permissions issue. Make sure that the directory that
holds your data is accessible to whatever user (probably MySQL) the
database processes run under.

MySQL will not add itself to the start menu, and there is no particularly
nice GUI way to stop the server either. Therefore, if you tend to start the
server by double clicking the MySQL executable, you should remember
to halt the process by hand by using mysqladmin, Task List, Task
Manager, or other Windows-specific means.

Verifying MySQL Installation


After MySQL, has been successfully installed, the base tables have been
initialized and the server has been started: you can verify that
everything is working as it should be via some simple tests.

Use the mysqladmin Utility to Obtain Server Status


Use mysqladmin binary to check the server version. This binary would
be available in /usr/bin on linux and in C:\mysql\bin on windows.

[root@host]# mysqladmin --version


It will produce the following result on Linux. It may vary depending
on your installation −
mysqladmin Ver 8.23 Distrib 5.0.9-0, for redhat-linux-gnu on i386
If you do not get such a message, then there may be some problem in
your installation and you would need some help to fix it.

Execute simple SQL commands using the MySQL Client


You can connect to your MySQL server through the MySQL client
and by using the mysql command. At this moment, you do not need to
give any password as by default it will be set as blank.

You can just use following command −

[root@host]# mysql
It should be rewarded with a mysql> prompt. Now, you are connected to
the MySQL server and you can execute all the SQL commands at the
mysql> prompt as follows −

mysql> SHOW DATABASES;


+ -+
| Database |
+ -+
| mysql |
| test |
+ -+
2 rows in set (0.13 sec)
Post-installation Steps
MySQL ships with a blank password for the root MySQL user. As soon
as you have successfully installed the database and the client, you need
to set a root password as given in the following code block −

[root@host]# mysqladmin -u root password "new_password";


Now to make a connection to your MySQL server, you would have to
use the following command −

[root@host]# mysql -u root -p


Enter password: *******
UNIX users will also want to put your MySQL directory in your PATH,
so you won't have to keep typing out the full path everytime you want
to use the command-line client.

For bash, it would be something like −

export PATH = $PATH:/usr/bin:/usr/sbin


Running MySQL at Boot Time
If you want to run the MySQL server at boot time, then make sure you
have the following entry in the /etc/rc.local file.

/etc/init.d/mysqld start

Running and Shutting down MySQL Server

First check if your MySQL server is running or not. You can use the
following command to check it −
ps -ef | grep mysqld
If your MySql is running, then you will see mysqld process listed out in
your result. If server is not running, then you can start it by using the
following command −
root@host# cd /usr/bin
./safe_mysqld&
Now, if you want to shut down an already running MySQL server, then
you can do it by using the following command −
root@host# cd /usr/bin
./mysqladmin -u root -p shutdown
Enter password: ******

Setting Up a MySQL User Account

For adding a new user to MySQL, you just need to add a new entry to
the user table in the database mysql.
The following program is an example of adding a new user guest with
SELECT, INSERT and UPDATE privileges with the
password guest123; the SQL query is −
root@host# mysql -u root -p
Enter password:*******
mysql>usemysql;
Database changed

mysql> INSERT INTO user


(host, user, password,
select_priv,insert_priv,update_priv)
VALUES ('localhost','guest',
PASSWORD('guest123'),'Y','Y','Y');
Query OK,1 row affected (0.20 sec)

mysql> FLUSH PRIVILEGES;


Query OK,1 row affected (0.01 sec)

mysql> SELECT host, user, password FROM user WHERE user


='guest';
+ + + +
| host | user | password |
+ + + +
| localhost | guest |6f8c114b58f2ce9e|
+ + + +
1 row inset(0.00 sec)
When adding a new user, remember to encrypt the new password using
PASSWORD() function provided by MySQL. As you can see in the
above example, the password mypass is encrypted to 6f8c114b58f2ce9e.
Notice the FLUSH PRIVILEGES statement. This tells the server to
reload the grant tables. If you don't use it, then you won't be able to
connect to MySQL using the new user account at least until the server is
rebooted.
You can also specify other privileges to a new user by setting the values
of following columns in user table to 'Y' when executing the INSERT
query or you can update them later using UPDATE query.
 Select_priv
 Insert_priv
 Update_priv
 Delete_priv
 Create_priv
 Drop_priv
 Reload_priv
 Shutdown_priv
 Process_priv
 File_priv
 Grant_priv
 References_priv
 Index_priv
 Alter_priv
Another way of adding user account is by using GRANT SQL
command. The following example will add user zara with
password zara123 for a particular database, which is named
as TUTORIALS.
root@host# mysql -u root -p password;
Enter password:*******
mysql>usemysql;
Database changed

mysql> GRANT
SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
-> ON TUTORIALS.*
-> TO 'zara'@'localhost'
-> IDENTIFIED BY 'zara123';
This will also create an entry in the MySQL database table called
as user.
NOTE − MySQL does not terminate a command until
you give a semi colon (;) at the end of the SQL command.
The /etc/my.cnf File Configuration
In most of the cases, you should not touch this file. By
default, it will have the following entries −
[mysqld]
datadir=/var/lib/mysql
socket =/var/lib/mysql/mysql.sock

[mysql.server]
user =mysql
basedir=/var/lib

[safe_mysqld]
err-log =/var/log/mysqld.log
pid-file =/var/run/mysqld/mysqld.pid
Here, you can specify a different directory for the error
log, otherwise you should not change any entry in this
table.
DATA FLOW DIAGRAMS:
A graphical tool used to describe and analyze the moment of data
through a system manual or automated including the process, stores of
data, and delays in the system. Data Flow Diagrams are the central tool
and the basis from which other components are developed. The
transformation of data from input to output, through processes, may be
described logically and independently of the physical components
associated with the system. The DFD is also know as a data flow graph
or a bubble chart.

CONTEXT DIAGRAM:
The top-level diagram is often called a “context diagram”. It contains a
single process, but it plays a very important role in studying the current
system. The context diagram defines the system that will be studied in
the sense that it determines the boundaries. Anything that is not inside
the process identified in the context diagram will not be part of the
system study. It represents the entire software element as a single
bubble with input and output data indicated by incoming and outgoing
arrows respectively.
TYPES OF DATA FLOW DIAGRAMS:
Data Flow Diagrams are of two types as follows:

(a) Physical DFD


(b) Logical DFD

1. PHYSICAL DFD:
Structured analysis states that the current system should be first
understand correctly. The physical DFD is the model of the current
system and is used to ensurethat the current system has been clearly
understood. Physical DFDs shows actual devices, departments, and
people etc., involved in the current system

2. LOGICAL DFD:
Logical DFDs are the model of the proposed system. They clearly
should show the requirements on which the new system should be

built. Later during design activity this is taken as the basis for
drawing the system’s structure charts.
BASIC NOTATION:

The Basic Notation used to create a DFD’s are as follows:

DATAFLOW:Data move in a specific direction from an


origin to a destination.

PROCESS: People, procedures, or devices that use or produce


(Transform) Data. The physical component is not
identified.

SOURCE: External sources or destination of data, which


may be People, programs, organizations or other
entities.

DATA STORE: Here data are stored or referenced by a


process in theSystem
DESIGN:

Design is the first step in moving from problem domain to


the solution domain. Design is essentially the bridge between
requirements specification and the final solution.

FACE IDENTIFICATION SYSTEM

FACE IDENTIFICATION SYSTEM


OPERATOR STUDENT FACE

Context Flow Diagram


Description: Context Flow Diagram gives us the complete
details about the inputs and outputs for a given system. In the
above system the main task is to identify a student face. So, the
operator and eyewitness are the inputs to our system and student
face is desired output.

LOGIN PROCESS

LOGIN
User IPdROCESS SCREEN

Password

ERROR IN
Level-1

Description: The inputs to the process are User Id and


Password given by the developer to allow the software available
for the user environment. After giving the inputs the code
checks whether the entered ones are valid are not. It displays
screen if match occurs otherwise error message if they are not
matched.

MAIN SCREEN PROCESS

MAIN SCREEN
OPERATOR ADD IMAGE

SEARCH IMAGE

CLIP IMAGE

CONSTRUCT IMAGE
Level -2

Description: This process mainly explains the different


screens that are available for the operator. Here the selection of
the screen depends on the operator and he can select whatever
screen he wants. The different screens that are available are Add
Image, Show or Search Image, Clip Image and Construct Image.

ADD IMAGE PROCESS

DATABASE

ADD PROCESS
OPERATOR DATA IS ADDED

ERROR

Level-3
Description:This process clearly illustrates adding the details
of the student such as name, alias name, age, gender, location,
address, state and city along with his photo. These details are
being added to the database, if any error is generated then it will
be prompted to the operator otherwise we get message data is
successfully added.

DATABASE
DATABASE

EYES

NOSE
FACE
FACE

HAIR

FOREHEAD

Level-4
Description: This is used for clipping the image into different
slices say eyes, forehead, lips, hair and nose. The input for this is
face which is divided into some slices which are stored in the
database. Even though the image is divided into slices, the
original image remains as it is.

UPDATE PROCESS

DATABASE

UPDATE PROCESS
DATA UPDATED
OPERATOR

Level-5
Description: Update process is mainly used for updating or
modifying the details of the student or person. This is used in
situation where we have entered the details incorrectly or we
want to add some new details.

Level-6
Description: Based on the instruction given by the
eyewitnesses, the operator brings the clips of the images from
the database and then goes for the construction of the image
based on those clips.

COMPARISON PROCESS

DATABASE

RESULT
FACE COMPARISON PROCESS
Level-7
Description: The face that is constructed in the above
process is sent to the comparison process where it
searches the image in the database.

DATABASE TABLES

Field Name Data Type Size

Student Id Number 5 (Primary Key)

First Name Varchar2 15

Last Name Varchar2 15

Alias Name Varchar2 15

D.O.B Date

Age Number 5

Gender Varchar2 15

Address Varchar2 15
City Varchar2 15

State Varchar2 15

Arrested Date

Date Varchar2 15

Crime Varchar2 15
Involved In

Photo

SOURCE CODE
WELCOME PAGE:-
from tkinter import *

from PIL import ImageTk,Image

from tkinter.ttk import *

import tkinter.ttk as ttk

from datetime import *

import time

import calendar

from clog import *


t=Tk()

t.geometry("1600x800+0+0")

t.title("Library Magement System")

t.config(bg="DarkOrange1")

st=Style()

st.configure('W.TButton',font=('Arial!',25,'bold','underline'),foreground
='red',background='black',borderwidth = '4')

#-------Heading with icon image------------

titlelbl=Label(t,text="AI FACIAL RECOGNITION CRIMINAL


IDENTIFICATION SYSTEM",font=("times now
roman",30,"bold"),justify=CENTER,background="black",foreground="go
ld")

titlelbl.config(anchor=CENTER)

titlelbl.place(x=0,y=0,width=1600,height=120)

ll=Label(t) img=Image.open(r"cimage\

realtime-bso.jpg")
img=img.resize((200,100))

img=ImageTk.PhotoImage(img)

ll.config(image=img)

ll.image=img

ll.place(x=5,y=10,width=200,height=100)

#---ICON_IMAGE---

icon1=Label(t)

icon1.place(x=100,y=125)

# Rotaion photo

x=1

def

a():

global x img=Image.open(r"cimage\

a"+str(x)+".jpg")

img=img.resize((1300,650))

img=ImageTk.PhotoImage(img)

icon1.config(image=img)
icon1.image=img

x=x+1

t.after(1000,a)

if x==7:

x=1

a()

def clock():

h=str(time.strftime("%H"))

m=str(time.strftime("%M"))

s=str(time.strftime("%S"))

dd=str(time.strftime("%d"))

mm=int(time.strftime("%m"))

yy=int(time.strftime("%y"))
lbldate.config(text=dd)

lblmonth.config(text=str(mm))

lblyear.config(text=str(yy))

if int(h)>12 and int(m)>0:

lblnoon.config(text="PM")

if int(h)>12:

h=str((int(h)-12))

lblhr.config(text=h)

lblmin.config(text=m)

lblsec.config(text=s)

lblhr.after(200,clock)

lblhr=Label(t,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblhr.place(x=1260,y=120,width=60,height=40)

lbldate=Label(t,text="Date",font=("times new
roman",15,"bold"),background="red",foreground="white")

lbldate.place(x=1260,y=170,width=60,height=40)
lblmin=Label(t,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblmin.place(x=1330,y=120,width=60,height=40)

lblmonth=Label(t,text="Month",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblmonth.place(x=1330,y=170,width=60,height=40)

lblsec=Label(t,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblsec.place(x=1400,y=120,width=60,height=40)

lblyear=Label(t,text="Year",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblyear.place(x=1400,y=170,width=60,height=40)

lblnoon=Label(t,text="AM",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblnoon.place(x=1470,y=120,width=60,height=40)

lblcurrent=Label(t,text="Date",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblcurrent.place(x=1470,y=170,width=60,height=40)

def launchLogin():

lg()

clock()

# start button

def next1():

lg()

b=Button(t,text="Töuch
M€!!!",style='W.TButton',command=launchLogin)
b.place(x=1250,y=730)

LOGIN PAGE:-

from tkinter import*

from PIL import ImageTk,Image

from tkinter.ttk import*

from tkinter import messagebox

from datetime import *

import mysql.connector

import mysql.connector as c

import time
import calendar

from cback1 import show

def lg():

t=Toplevel()

t.geometry("1600x1600+0+0")

t.title("Login!!!")

st=Style()

#-----------login page Bckground-------------

l=Label(t)

img=Image.open(r"cimage\b4.JPg")

img=img.resize((1600,700))

img=ImageTk.PhotoImage(img)

l.config(image=img)

l.image=img

l.place(x=0,y=105)

#------------Heading with icon Image-----------

titlelbl=Label(t,text="AI FACIAL RECOGINITION CRIMINAL


IDENTIFICATION SYSTEM",font=("times now
roman",30,"bold"),justify=CENTER,background="black",foreground="go
ld")
titlelbl.config(anchor=CENTER)

titlelbl.place(x=0,y=0,width=1600,height=120)

ll=Label(t) img2=Image.open(r"cimage\

realtime-bso.jpg")

img2=img2.resize((200,100))

img2=ImageTk.PhotoImage(img2)

ll.config(image=img2)

ll.image=img2

ll.place(x=5,y=10,width=200,height=100)

#---------log background image-------------

lll=Label(t) img3=Image.open(r"libimage\

logobg.jpg") img3=img3.resize((800,400))

img3=ImageTk.PhotoImage(img3)

lll.config(image=img3)

lll.image=img3

lll.place(x=385,y=400)
# Time and Date

def clock():

h=str(time.strftime("%H"))

m=str(time.strftime("%M"))

s=str(time.strftime("%S"))

dd=str(time.strftime("%d"))

mm=int(time.strftime("%m"))

yy=int(time.strftime("%y"))

lbldate.config(text=dd)

lblmonth.config(text=str(mm))

lblyear.config(text=str(yy))

if int(h)>12 and int(m)>0:

lblnoon.config(text="PM")

if int(h)>12:

h=str((int(h)-12))
lblhr.config(text=h)

lblmin.config(text=m)

lblsec.config(text=s)

lblhr.after(200,clock)

lblhr=Label(t,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblhr.place(x=640,y=190,width=60,height=40)

lbldate=Label(t,text="Date",font=("times new
roman",15,"bold"),background="red",foreground="white")

lbldate.place(x=640,y=240,width=60,height=40)

lblmin=Label(t,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblmin.place(x=710,y=190,width=60,height=40)

lblmonth=Label(t,text="Month",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblmonth.place(x=710,y=240,width=60,height=40)
lblsec=Label(t,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblsec.place(x=780,y=190,width=60,height=40)

lblyear=Label(t,text="Year",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblyear.place(x=780,y=240,width=60,height=40)

lblnoon=Label(t,text="AM",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblnoon.place(x=850,y=190,width=60,height=40)

lblcurrent=Label(t,text="Date",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblcurrent.place(x=850,y=240,width=60,height=40)

clock()
#=================Heading content==========

l1=Label(t,text=" ɭOGIN ĦERE",font=("Californian


FB",30,"bold"),background="black",foreground="gold")

l1.place(x=665,y=410)

#=======TEXT AREA==============

l1=Label(t,text="* User Id
:",font='18',background="black",foreground="red")

l1.place(x=550,y=520)

t1=Entry(t,font="bold")

t1.place(x=700,y=520,width=320)

l2=Label(t,text="* Password
:",font='18',background="black",foreground="red")

l2.place(x=550,y=590)

t2=Entry(t,font="bold")

t2.place(x=700,y=590,width=320)

t2.config(show="*")

#==============MySql connectivity======================

def login():

if t1.get()=="" or t2.get()=="":
messagebox.showerror("Error","All fields are required",parent=t)

else:

try:

con=c.connect(host="localhost",user="root",password="",port="3306",
database="library_db")

cur=con.cursor()

cur.execute('select * from admin where email=%s and


password=%s',(t1.get(),t2.get()))

row=cur.fetchone()

if row==None:

messagebox.showerror('Error','Invalid Userid And


Password',parrent=t)

loginclear()

t1.focus()

else:

appscreen()

con.close()

except Exception as es:


messagebox.showerror('Error',f'Error Due to :
{str(es)}',parent=t)

def loginclear():

t1.delete(0,END)

t2.delete(0,END)

def appscreen():

show()

# login Button

u=Label(t)

b=Button(t,image=img)

img=Image.open(r"image\l1.jpg")

img=img.resize((152,48))

img=ImageTk.PhotoImage(img)

b.config(image=img,cursor="hand2",command=login)

b.image=img
b.place(x=550,y=640)

t2.config(show="*")

# exit Button

u1=Label(t)

b=Button(t,image=img)

img=Image.open(r"image\bc.png")

img=img.resize((154,47))

img=ImageTk.PhotoImage(img)

b.config(image=img,cursor="hand2",command=t.destroy)

b.image=img

b.place(x=850,y=640)

# Update Password

def mouseClick():

rog=Toplevel()

rog.title("Change password")

rog.geometry("500x300+530+280")
rog.iconbitmap("aa.ico")

rog.resizable(0,0)

rog.configure(bg='powder blue')

label=Label(rog,text="New
password",font=("cursive",30,'bold'),background='powder
blue',foreground='red')

label.place(x=105,y=15)

user=Label(rog,text='*User ID :',background='powder
blue',foreground='black',font=("cursive",12,'bold'))

user.place(x=40,y=95)

user = Label(rog, text='*New password :', background='powder


blue', foreground='black', font=("cursive", 12, 'bold'))

user.place(x=40, y=170)

e1 = Entry(rog, width=24, font=('arial', 9, 'bold'))

e1.place(x=190, y=95,width=250,height=30)

e2 = Entry(rog, width=24, font=('arial', 9, 'bold'))


e2.place(x=190, y=170,width=250,height=30)

def chan_pas():

a=e1.get()

b=e2.get()

conn=c.connect(host="localhost",user="root",password="",port="3306
", database="library_db")

cursor=conn.cursor()

cursor.execute("select * from admin where aid='"+a+"'")

#conn.commit()

data=cursor.fetchone()

if data!=None:

cursor=conn.cursor()

cursor.execute("update admin set password='"+b+ "' where


aid='"+a+"'")

conn.commit()

messagebox.showinfo("Library System","Your Password is


changed !",parent=rog)
rog.destroy()

else:

messagebox.showinfo("Library System","This Userid is not


requird",parent=rog)

# Submit Button

s=Label(rog)

b=Button(rog,image=img)

img6=Image.open(r"libimage\Submit.png")

img6=img6.resize((150,40))

img6=ImageTk.PhotoImage(img6)

b.config(image=img6,cursor="hand2",command=chan_pas)

b.image=img6

b.place(x=170,y=240)

rog.mainloop()
# Change Password Button

o1=Label(t)

b=Button(t,image=img)

img=Image.open(r"libimage\forgotpass.png")

img=img.resize((380,45))

img=ImageTk.PhotoImage(img)

b.config(image=img,cursor="hand2",command=mouseClick)

b.image=img

b.place(x=600,y=730)

#lg()

FACE RECOGNITION PAGE:-


from tkinter import*

from PIL import ImageTk,Image

from PIL import Image

from tkinter.ttk import*

from tkinter.ttk import*

import numpy as np

from PIL import Image

import pandas as pd

import os

import cv2

from os import listdir

from cmain2 import *

from criminal import

def next1():

reg()

def next2():

main()
def show():

t=Toplevel()

t.geometry("2000x1800")

t.config(bg="DarkOrange1")

t.title("FACIO")

st=Style()

#----Background Image---------

l=Label(t)

img=Image.open(r"cimage\a7.jpg")

img=img.resize((800,800))

img=ImageTk.PhotoImage(img)

l.config(image=img)

l.image=img

l.place(x=750,y=100,relheight=1,relwidth=1)
titlelbl=Label(t,text="AI FACIAL RECOGNITION CRIMINAL
IDENTIFICATION SYSTEM",font=("times now
roman",30,"bold"),justify=CENTER,background="black",foreground="go
ld")

titlelbl.config(anchor=CENTER)

titlelbl.place(x=0,y=0,width=1600,height=120)

ll=Label(t) img2=Image.open(r"cimage\

realtime-bso.jpg")

img2=img2.resize((200,100))

img2=ImageTk.PhotoImage(img2)

ll.config(image=img2)

ll.image=img2

ll.place(x=5,y=10,width=200,height=100)

l1=Label(t,text="* WELCOME TO AI CRIMINAL FACIAL RECOGNITIONN


SYSTEM * ",width='60',font='bold',background="Dark Orange1")

l1.place(x=40,y=130)

l2=Label(t,text="Once step ahead to reach",background="Dark


Orange1")
l2.place(x=67,y=155)

l3=Label(t,text="This Software is dadicated for store the criminals


records and find out the Info.",font='100',background="Dark Orange1")

l3.place(x=50,y=235)

l4=Label(t,text="•first of all you have to successfully register the


criminal along with giving ",font='10',background="Dark Orange1")

l4.place(x=60,y=270)

l5=Label(t,text="all info. that is heppend and all background record


includig his/her",font='1000px',background="Dark Orange1")

l5.place(x=85,y=305)

l6=Label(t,text="picture. If a criminal is already registerd with their


name",font='1000px',background="Dark Orange1")

l6.place(x=115,y=340)

l7=Label(t,text="but if he\she cought by Police and even he\she re-


",font='1000px',background="Dark Orange1")

l7.place(x=140,y=375)
l7=Label(t,text="registers by other name,so while MATCH
80%",font='1000px',background="Dark Orange1")

l7.place(x=160,y=410)

l72=Label(t,text="Face data then the result will give


",font='1000px',background="Dark Orange1")

l72.place(x=187,y=445)

l73=Label(t,text="'DATA MATCH FOUND.....'",font = "Helvetica 16


bold italic",background="Dark Orange1")

l73.place(x=210,y=500)

l8=Label(t,text="This Facial recognition algorithms create a


biometric",font='1000px',background="Dark Orange1")

l8.place(x=170,y=550)

l9=Label(t,text="templet by detecting and measuring various


characteristic or feature",font='1000px',background="Dark Orange1")

l9.place(x=115,y=585)
l11=Label(t,text="point, including location of the eyes, eyebrows
noes, mouth, chin and ears.",font='120px',background="Dark
Orange1")

l11.place(x=75,y=620)

# For testing phase

def TrackImages():

recognizer = cv2.face.LBPHFaceRecognizer_create()

# Reading the trained model

recognizer.read("Trainner.yml")

harcascadePath = "haarcascade_frontalface_default.xml"

faceCascade = cv2.CascadeClassifier(harcascadePath)

# getting the name from "userdetails.csv"

#df = pd.read_csv("UserDetails.csv")

cam = cv2.VideoCapture(0)

font = cv2.FONT_HERSHEY_SIMPLEX

while True:

ret, im = cam.read()

gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)

faces = faceCascade.detectMultiScale(gray, 1.2)


for(x, y, w, h) in faces: #cv2.rectangle(im,

(x,y),(x+w,y+h),color,2)

cv2.rectangle(im, (x, y), (x + w, y + h), (250,0,0),2)

id, conf = recognizer.predict(gray[y:y + h, x:x + w])

confidence=100*(1-conf/300)

con=c.connect(host="localhost",user="root",password="",port="3306",
database="criminal_db")

cur=con.cursor()

cur.execute("select name from criminal where id="+str(id))

s_name=cur.fetchone()

s_name= ''+''.join(s_name)

if confidence>85:

cv2.putText(im,s_name,(x,y-5),font,1, (120, 120, 350), 2)

#cam.release()

#cv2.destroyAllWindows()

#from criminaldetails import detail

break
elif confidence>60:

cv2.putText(im,"Himanshu",(x,y-5),font, 1, (120, 120, 350),


2)

else:

cv2.putText(im,"Unknown", (x, y -5),font, 1, (120, 120, 35),


2)

#messagebox.showinfo('Result','User not registered..!')

if(conf > 75):

noOfFile = len(os.listdir("ImageUnknown"))+1

cv2.imwrite("ImageUnknown/Image"+

str(noOfFile) + ".jpg", im[y:y + h, x:x + w])

#cv2.putText(im, str(tt), (x, y + h),font, 1, (255, 255, 255), 2)

cv2.imshow('im', im)

if (cv2.waitKey(1)== ord('q')):

break

cam.release()

cv2.destroyAllWindows()
# Image on Reg. Button

l=Label()

b=Button(t,image=img)

img=Image.open(r"Cimage\B2.png")

img=img.resize((770,110))

img=ImageTk.PhotoImage(img)

b.config(image=img,cursor="hand2",command=TrackImages)

b.image=img

b.place(x=750,y=700)

# Image on Reg. Button

l=Label()

b=Button(t,image=img)

img=Image.open(r"Cimage\B1.png")

img=img.resize((250,70))

img=ImageTk.PhotoImage(img)
b.config(image=img,cursor="hand2",command=next1)

b.image=img

b.place(x=70,y=700)

# Image on login Button

l=Label()

b=Button(t,image=img)

img=Image.open(r"libimage\next.jpg")

img=img.resize((200,70))

img=ImageTk.PhotoImage(img)

b.config(image=img,cursor="hand2",command=next2)

b.image=img

b.place(x=450,y=700)

#--------------Face Recignition Button---------------

#show()
REGISTER CRIMINAL:-

from tkinter import*

from PIL import ImageTk,Image

from tkinter.ttk import*

from tkinter import messagebox

import mysql.connector

import mysql.connector as c

import numpy as np

from PIL import Image

import pandas as pd

import os

import cv2
from os import listdir

import tkinter.font as font

from pathlib import Path

import mysql.connector

import mysql.connector as

def reg():

t=Toplevel()

t.geometry("2000x1800")

t.title("Registraion")

t.config(bg="powder blue")

st=Style()

def back():

t.destroy()

#----Background Image---------

l=Label(t) img=Image.open(r"C:\Users\hp\Desktop\

img.jpg") img=img.resize((800,650))
img=ImageTk.PhotoImage(img)

l.config(image=img)

l.image=img

l.place(x=0,y=70)

l=Label(t) img=Image.open(r"C:\Users\hp\Desktop\

passport2.jpg") img=img.resize((200,150))

img=ImageTk.PhotoImage(img)

l.config(image=img)

l.image=img

l.place(x=1000,y=70)

titlelbl=Label(t,text="NEW CRIMINAL REGISTER ",font=("times now


roman",50,"bold"),justify=CENTER,background="black",foreground="dark
orange")

titlelbl.config(anchor=CENTER)

titlelbl.place(x=0,y=0,width=1600,height=70)

l=Label(t) img2=Image.open(r"cimage\realtime-

bso.jpg") img2=img2.resize((90,70))
img2=ImageTk.PhotoImage(img2)

l.config(image=img2)

l.image=img2

l.place(x=20,y=0,width=80,height=70)

frame1=Label(t,background="black")

frame1.place(x=3,y=725,width=800,height=75)

#---- Text Area fo Reg....-----------

l2=Label(t,text="*ID:",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l2.place(x=840,y=230)

t2=Entry(t,width=30,font="bold")

t2.place(x=1100,y=230)

l3=Label(t,text="*Full Name:",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l3.place(x=840,y=270)

t3=Entry(t,width=30,font="bold")

t3.place(x=1100,y=270)

l4=Label(t,text="*DOB{yy/mm/dd}:",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")
l4.place(x=840,y=310)

t4=Entry(t,width=30,font="bold")

t4.place(x=1100,y=310)

l5=Label(t,text="*Gender:",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l5.place(x=840,y=350)

t5=Entry(t,width=30,font="bold")

t5.place(x=1100,y=350)

l6=Label(t,text="*Age :",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l6.place(x=840,y=390)

t6=Entry(t,width=30,font="bold")

t6.place(x=1100,y=390)

l7=Label(t,text="*Address :",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l7.place(x=840,y=430)

t7=Entry(t,width=30,font="bold")

t7.place(x=1100,y=430)

l8=Label(t,text="*Adhar Number
:",font=('arial',15,"bold"),background="powder blue",foreground="dim gray")

l8.place(x=840,y=470)

t8=Entry(t,width=30,font="bold")

t8.place(x=1100,y=470)
l9=Label(t,text="*State :",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l9.place(x=840,y=510)

t9=Entry(t,width=30,font="bold")

t9.place(x=1100,y=510)

l10=Label(t,text="*Height :",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l10.place(x=840,y=550)

t10=Entry(t,width=30,font="bold")

t10.place(x=1100,y=550)

l11=Label(t,text="*Phone no :",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l11.place(x=840,y=590)

t11=Entry(t,width=30,font="bold")

t11.place(x=1100,y=590)

l12=Label(t,text="*Crime Done:",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l12.place(x=840,y=630)

t12=Entry(t,width=30,font="bold")

t12.place(x=1100,y=630)

l13=Label(t,text="*Arrest Date :",font=('arial',15,"bold"),background="powder


blue",foreground="dim gray")

l13.place(x=840,y=670)
t13=Entry(t,width=30,font="bold")

t13.place(x=1100,y=670)

l14=Label(t,text="*Arrest Place :",font=('arial',15,"bold"),background="powder


blue",foreground="dim gray")

l14.place(x=840,y=710)

t14=Entry(t,width=30,font="bold")

t14.place(x=1100,y=710)

l15=Label(t,text="*Arresting Officer
:",font=('arial',15,"bold"),background="powder blue",foreground="dim gray")

l15.place(x=840,y=750)

t15=Entry(t,width=30,font="bold")

t15.place(x=1100,y=750)

def destroy_register():

t.destroy()

# The function below is used for checking

# whether the text below is number or not ?

def is_number(s):

try:

float(s)
return True

except ValueError:

pass

try:

import unicodedata

unicodedata.numeric(s)

return True

except (TypeError, ValueError):

pass

# Training the images saved in training image folder

def TrainImages():

# Local Binary Pattern Histogram is an Face Recognizer

# algorithm inside OpenCV module used for training the image dataset

recognizer = cv2.face.LBPHFaceRecognizer_create()

# Specifying the path for HaarCascade file

harcascadePath =

"haarcascade_frontalface_default.xml" # creating

detector for faces

detector =

cv2.CascadeClassifier(harcascadePath) # Saving

the detected faces in variables

faces, id = getImagesAndLabels("data")

# Saving the trained faces and their respective ID's


# in a model named as

"trainner.yml". recognizer.train(faces,

np.array(id))

recognizer.save("Trainner.yml")

# Displaying the message

messagebox.showinfo("Success","Completed captured Images


Trained",parent=t)

def Collecting_Samples():

if t2.get()=="" or t3.get()=="" or t4.get()=="" or t5=="" or t6.get()=="" or


t7.get()=="" or t8.get()=="" or t9.get()=="" or t10.get()=="" or t11.get()=="" or
t12.get()=="" or t13.get()=="" or t14.get()=="" or t15.get()=="":

messagebox.showinfo('Message','Fields cannot be embty..!')

else:

try:

con=c.connect(host="localhost",user="root",password="",port="3306",database=
"criminal_db")

cur=con.cursor()

#cur.execute("select * from criminal order by id desc limit 1")

cur.execute("select * from criminal")

row=cur.fetchall()
name =(t3.get())

id= (t2.get())

cur.execute("insert into
criminal(id,name,dob,gender,age,address,adhar,state,height,phoneno,crimedone,
arrestdate,arrestplace,arrestingofficer) values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,
%s,%s,%s)",
(t2.get(),t3.get(),t4.get(),t5.get(),t6.get(),t7.get(),t8.get(),t9.get(),t10.get(),t11.get(
),t12.get(),t13.get(),t14.get(),t15.get()))

con.commit()

con.close()

# Checking if the ID is numeric and name is Alphabetical

if(is_number(id) and name.isalpha()):

# Opening the primary camera if you want to access

# the secondary camera you can mention the

number # as 1 inside the parenthesis

cam = cv2.VideoCapture(0)

# Specifying the path to haarcascade file

harcascadePath = "haarcascade_frontalface_default.xml"

# Creating the classier based on the haarcascade file.

detector = cv2.CascadeClassifier(harcascadePath)
# Initializing the sample number(No. of images) as 0

sampleNum = 0

while(True):

# Reading the video captures by camera frame by frame

ret, img = cam.read()

# Converting the image into grayscale as most

of # the the processing is done in gray scale

format gray = cv2.cvtColor(img,

cv2.COLOR_BGR2GRAY)

# It converts the images in different sizes

# (decreases by 1.3 times) and 5 specifies the

# number of times scaling happens

faces = detector.detectMultiScale(gray, 1.3, 5)

# For creating a rectangle around the image

for (x, y, w, h) in faces:

# Specifying the coordinates of the image as well

# as color and thickness of the rectangle.

# incrementing sample number for each

image cv2.rectangle(img, (x, y), (

x + w, y + h), (255, 0, 0), 2)

sampleNum = sampleNum + 1
# saving the captured face in the dataset folder

# TrainingImage as the image needs to be trained

# are saved in this folder

cv2.imwrite(

"data\ "+name +"."+str(id) +'.'+ str(

sampleNum) + ".jpg", gray[y:y + h, x:x +

w]) # display the frame that has been captured

# and drawn rectangle around it.

cv2.imshow('frame', img)

# wait for 100 milliseconds

if cv2.waitKey(100) & 0xFF ==

ord('q'): break

# break if the sample number is more than 60

elif sampleNum>60:

break

# releasing the resources

cam.release()

# closing all the windows

cv2.destroyAllWindows()

# Displaying message for the user

res = "Images Saved for ID : " +str(id) +" Name : "+

name # # Creating the entry for the user in a csv file


row = [id, name]

#with open('UserDetails.csv', 'a+') as csvFile:

# writer = csv.writer(csvFile)

# Entry of the row in csv file

# writer.writerow(row)

# message.configure(text = res)

else:

if(is_number(id)):

res = "Enter Alphabetical Name"

message.configure(text = res)

if(name.isalpha()):

res = "Enter Numeric Id"

message.configure(text = res)

messagebox.showinfo("Success","Details completed and also capture


image",parent=t)

regclear()

except Exception as es:

print(es)

messagebox.showerror("Error",f"Error due to:{str(es)}",parent=t)

def getImagesAndLabels(path):
# get the path of all the files in the folder

imagePaths =[os.path.join(path, f) for f in os.listdir(path)]

faces =[]

# creating empty ID list

Ids =[]

# now looping through all the image paths and loading the

# Ids and the images saved in the folder

for imagePath in imagePaths:

# loading the image and converting it to gray scale

pilImage = Image.open(imagePath).convert('L')

# Now we are converting the PIL image into numpy array

imageNp = np.array(pilImage, 'uint8')

# getting the Id from the image

id = int(os.path.split(imagePath)[-1].split(".")[1])

# extract the face from the training image

sample faces.append(imageNp)

Ids.append(id)

return faces, Ids

# For testing phase

def TrackImages():

recognizer = cv2.face.LBPHFaceRecognizer_create()
# Reading the trained model

recognizer.read("Trainner.yml")

harcascadePath = "haarcascade_frontalface_default.xml"

faceCascade = cv2.CascadeClassifier(harcascadePath)

# getting the name from "userdetails.csv"

#df = pd.read_csv("UserDetails.csv")

cam = cv2.VideoCapture(0)

font = cv2.FONT_HERSHEY_SIMPLEX

while True:

ret, im = cam.read()

gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)

faces = faceCascade.detectMultiScale(gray, 1.2, 5)

for(x, y, w, h) in faces:

cv2.rectangle(im, (x, y), (x + w, y + h), (225, 0, 0), 2)

id, conf = recognizer.predict(gray[y:y + h, x:x + w])

if(conf < 50):

aa = df.loc[df['id'] == id]['Name'].values

tt = str(id)+"-"+aa

else:

Id ='Unknown'
tt = str(id)

if(conf > 75):

noOfFile = len(os.listdir("ImageUnknown"))+1

cv2.imwrite("Image"+

str(noOfFile) + ".jpg", im[y:y + h, x:x + w])

cv2.putText(im, str(tt), (x, y + h),

font, 1, (255, 255, 255), 2)

cv2.imshow('im', im)

if (cv2.waitKey(1)== ord('q')):

break

cam.release()

cv2.destroyAllWindows()

def Capture_Image():

global path

cap=cv2.VideoCapture(0)

mydb=mysql.connector.connect(host="localhost",user="root",password="",port=
"3306",database="criminal_db")

my=mydb.cursor()
res=my.execute("select count(*) from criminal")

rows=my.fetchall()

x = rows[0][0]

x+=1

while True:

rect,frame=cap.read()

cv2.imshow("MY Picture",frame)

cv2.imwrite(r"e"+str(x)+".jpg",frame)

if cv2.waitKey(1)&0xff==ord('w'):

break

cap.release()

cv2.destroyAllWindows()

img_lb=Label(t)

img_lb.place(x=1200,y=70)

path="d"+str(x)+".jpg"

img=Image.open(r"e"+str(x)+".jpg")

img=img.resize((200,150))

img=ImageTk.PhotoImage(img)
img_lb.config(image=img)

img_lb.image=img

l=Label()

b=Button(t,image=img)

img=Image.open(r"C:\Users\hp\Desktop\sample2.png")

img=img.resize((200,50))

img=ImageTk.PhotoImage(img)

b.config(image=img,command=Collecting_Samples)

b.image=img

b.place(x=20,y=730)

l=Label()

b=Button(t,image=img)

img=Image.open(r"C:\Users\hp\Desktop\collecting1.png")

img=img.resize((200,50))

img=ImageTk.PhotoImage(img)

b.config(image=img,command=Capture_Image)

b.image=img

b.place(x=300,y=730)
l=Label()

b=Button(t,image=img)

img=Image.open(r"C:\Users\hp\Desktop\training.png")

img=img.resize((200,50))

img=ImageTk.PhotoImage(img)

b.config(image=img,command=TrainImages)

b.image=img

b.place(x=575,y=730)

l=Label()

b=Button(t,image=img)

img=Image.open(r"C:\Users\hp\Desktop\back2.py.png")

img=img.resize((200,50))

img=ImageTk.PhotoImage(img)

b.config(image=img,command=back)

b.image=img

b.place(x=575,y=650)

def regclear():

t2.delete(0,END)

t3.delete(0,END)
t4.delete(0,END)

t5.delete(0,END)

t6.delete(0,END)

t7.delete(0,END)

t8.delete(0,END)

t9.delete(0,END)

t10.delete(0,END)

t11.delete(0,END)

t12.delete(0,END)

t13.delete(0,END)

t14.delete(0,END)

t15.delete(0,END)

#reg()
CRIMINAL RECORD PAGE:-

from tkinter import *

from PIL import

ImageTk,Image from tkinter.ttk

import * import tkinter.ttk as

ttk

import mysql.connector

import mysql.connector as c

from tkinter import messagebox

from datetime import *

import time

import calendar

from alldetail import *


from csearch import *

from cdelete import *

def main():

root = Toplevel()

root.title("Library Managment")

root.minsize(width=400,height=400)

root.geometry("1600x800+0+0")

# Backgroud image

l=Label(root) img=Image.open(r"libimage\

LIB.jpg") img=img.resize((1600,700))

img=ImageTk.PhotoImage(img)

l.config(image=img)

l.image=img

l.place(x=0,y=105)

#-------------Heading with icon Image----------


titlelbl=Label(root,text="AI FACIAL RECOGINITION CRIMINAL IDENTIFICATION
SYSTEM",font=("times now
roman",30,"bold"),justify=CENTER,background="black",foreground="gold")

titlelbl.config(anchor=CENTER)

titlelbl.place(x=0,y=0,width=1600,height=120)

ll=Label(root) img2=Image.open(r"cimage\

realtime-bso.jpg") img2=img2.resize((200,100))

img2=ImageTk.PhotoImage(img2)

ll.config(image=img2)

ll.image=img2

ll.place(x=5,y=10,width=200,height=100)

# heading2

headingFrame1 = Frame(root,bg="#FFBB00",bd=5)

headingFrame1.place(relx=0.2,rely=0.2,relwidth=0.6,relheight=0.16)

headingLabel = Label(headingFrame1, text="Welcome to \n AI Facial


Recoginiton Criminal Identification System",justify=CENTER, bg='black', fg='white',
font=('Courier',20))

headingLabel.config(anchor=CENTER)
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)

#--------------button for SEAECH CRIMINAL-----------

btn2 = Button(root,text="SEARCH CRIMINAL BY ID",bg='black',


fg='white',command=search)

btn2.place(relx=0.28,rely=0.55, relwidth=0.45,relheight=0.1)

#--------------button for view ALL CRIMINAL RECORDS--------------

btn3 = Button(root,text="ALL CRIMINAL RECORDS",bg='black',


fg='white',command=view)

btn3.place(relx=0.28,rely=0.65, relwidth=0.45,relheight=0.1)

#-------------button for DELETE CRIMINAL RECORDS--------------

btn4 = Button(root,text="DELETE CRIMINAL RECORD BY ID",bg='black',


fg='white',command=deleteCriminal)

btn4.place(relx=0.28,rely=0.75, relwidth=0.45,relheight=0.1)

# Date and Time

def clock():

h=str(time.strftime("%H"))
m=str(time.strftime("%M"))

s=str(time.strftime("%S"))

dd=str(time.strftime("%d"))

mm=int(time.strftime("%m"))

yy=int(time.strftime("%y"))

lbldate.config(text=dd)

lblmonth.config(text=str(mm))

lblyear.config(text=str(yy))

if int(h)>12 and int(m)>0:

lblnoon.config(text="PM")

if int(h)>12:

h=str((int(h)-12))

lblhr.config(text=h)

lblmin.config(text=m)

lblsec.config(text=s)

lblhr.after(200,clock)
lblhr=Label(root,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblhr.place(x=1260,y=120,width=60,height=40)

lbldate=Label(root,text="Date",font=("times new
roman",15,"bold"),background="red",foreground="white")

lbldate.place(x=1260,y=170,width=60,height=40)

lblmin=Label(root,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblmin.place(x=1330,y=120,width=60,height=40)

lblmonth=Label(root,text="Month",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblmonth.place(x=1330,y=170,width=60,height=40)

lblsec=Label(root,text="12",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblsec.place(x=1400,y=120,width=60,height=40)

lblyear=Label(root,text="Year",font=("times new
roman",15,"bold"),background="red",foreground="white")
lblyear.place(x=1400,y=170,width=60,height=40)

lblnoon=Label(root,text="AM",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblnoon.place(x=1470,y=120,width=60,height=40)

lblcurrent=Label(root,text="Date",font=("times new
roman",15,"bold"),background="red",foreground="white")

lblcurrent.place(x=1470,y=170,width=60,height=40)

clock()

root.mainloop()

#main()
CRIMINAL SEARCH:-

from tkinter import *

from PIL import ImageTk,Image

from tkinter import messagebox

import mysql.connector

import mysql.connector as c

from criminaldetails import

detail

def search():

global criminalInfo1,Canvas1,con,cur,criminal,root
root = Toplevel()

root.title("Library")

root.minsize(width=400,height=400)

root.geometry("600x500+480+290")

con =
c.connect(host="localhost",user="root",password="",port="3306",database="cri
minal_db")

cur = con.cursor()

Canvas1 = Canvas(root)

Canvas1.config(bg="DarkOrange1")

Canvas1.pack(expand=True,fill=BOTH)

headingFrame1 = Frame(root,bg="#FFBB00",bd=5)

headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)

headingLabel = Label(headingFrame1, text="SEARCH CRIMINAL ", bg='black',


fg='white', font=('Courier',15))
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)

labelFrame = Frame(root,bg='black')

labelFrame.place(relx=0.1,rely=0.4,relwidth=0.8,relheight=0.4)

# Criminal ID

lb1 = Label(labelFrame,text="CRIMINAL ID : ", bg='black', fg='white')

lb1.place(relx=0.05,rely=0.2, relheight=0.08)

criminalInfo1 = Entry(labelFrame)

criminalInfo1.place(relx=0.3,rely=0.2, relwidth=0.62, relheight=0.08)

def mouseclick():

def detail():

rog=Toplevel()

rog.geometry("2000x1800")

rog.title("Registraion")

rog.iconbitmap("aa.ico")

#rog.resizable(0,0)

rog.config(bg="powder blue")
l=Label(rog) img=Image.open(r"C:\Users\hp\Desktop\

frame2.png") img=img.resize((700,500))

img=ImageTk.PhotoImage(img)

l.config(image=img)

l.image=img

l.place(x=0,y=150)

#-------------Heading with icon Image----------

titlelbl=Label(rog,text="AI FACIAL RECOGINITION CRIMINAL


IDENTIFICATION SYSTEM",font=("times now
roman",30,"bold"),justify=CENTER,background="black",foreground="gold")

titlelbl.config(anchor=CENTER)

titlelbl.place(x=0,y=0,width=1600,height=120)

ll=Label(rog) img2=Image.open(r"cimage\

realtime-bso.jpg") img2=img2.resize((200,100))
img2=ImageTk.PhotoImage(img2)

ll.config(image=img2)

ll.image=img2

ll.place(x=5,y=10,width=200,height=100)

#---- Text Area fo Reg....-----------

l1=Label(rog,text="Criminal
id:",font=('arial',15,"bold"),background="powder blue",foreground="dim gray")

l1.place(x=880,y=170)

l2=Label(rog,text="Full
Name:",font=('arial',15,"bold"),background="powder blue",foreground="dim
gray")

l2.place(x=880,y=210)

l4=Label(rog,text="DOB{yy/mm/dd}:",font=('arial',15,"bold"),background="powde
r blue",foreground="dim gray")

l4.place(x=880,y=250)

l5=Label(rog,text="Gender:",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")
l5.place(x=880,y=290)

l6=Label(rog,text="Age :",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l6.place(x=880,y=330)

l7=Label(rog,text="Adhar Number
:",font=('arial',15,"bold"),background="powder blue",foreground="dim gray")

l7.place(x=880,y=370)

l8=Label(rog,text="Address :",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l8.place(x=880,y=410)

l9=Label(rog,text="Height :",font=('arial',15,"bold"),background="powder
blue",foreground="dim gray")

l9.place(x=880,y=450)

l10=Label(rog,text="Phone no
:",font=('arial',15,"bold"),background="powder blue",foreground="dim gray")

l10.place(x=880,y=490)

l11=Label(rog,text="Crime Doe
:",font=('arial',15,"bold"),background="powder blue",foreground="dim gray")

l11.place(x=880,y=530)

l12=Label(rog,text="Arresr
Date:",font=('arial',15,"bold"),background="powder blue",foreground="dim
gray")

l12.place(x=880,y=570)

l13=Label(rog,text="Arrest Place
:",font=('arial',15,"bold"),background="powder blue",foreground="dim gray")
l13.place(x=880,y=610)

l14=Label(rog,text="Arrest Officer
:",font=('arial',15,"bold"),background="powder blue",foreground="dim gray")

l14.place(x=880,y=650)

x=criminalInfo1.get()

con=c.connect(host="localhost",user="root",password="",port="3306",
database="criminal_db")

cur=con.cursor()

cur.execute("select * from criminal where id='"+x+"'")

rows=cur.fetchall()

# print(rows)

for i in rows:

t1=Label(rog,text=i[0],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t1.place(x=1140,y=170)

t2=Label(rog,text=i[1],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t2.place(x=1140,y=210)

t4=Label(rog,text=i[2],font=('arial',15,"bold"),background="powder
blue",foreground="orange")
t4.place(x=1140,y=210)

t5=Label(rog,text=i[3],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t4.place(x=1140,y=250)

t6=Label(rog,text=i[4],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t6.place(x=1140,y=290)

t7=Label(rog,text=i[5],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t7.place(x=1140,y=330)

t8=Label(rog,text=i[6],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t8.place(x=1140,y=370)

t9=Label(rog,text=i[7],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t9.place(x=1140,y=410)

t10=Label(rog,text=[8],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t10.place(x=1140,y=450)

t11=Label(rog,text=i[9],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t11.place(x=1140,y=490)

t12=Label(rog,text=i[10],font=('arial',15,"bold"),background="powder
blue",foreground="orange")
t12.place(x=1140,y=530)

t13=Label(rog,text=i[11],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t13.place(x=1140,y=570)

t14=Label(rog,text=i[12],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t14.place(x=1140,y=610)

t15=Label(rog,text=i[13],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t15.place(x=1140,y=650)

t16=Label(rog,text=i[14],font=('arial',15,"bold"),background="powder
blue",foreground="orange")

t16.place(x=1140,y=690)

con.commit()

con.close()

img_lb=Label(rog)

img_lb.place(x=200,y=300)

path="e"+str(x)+".jpg"

img=Image.open(r"e"+str(x)+".jpg")

img=img.resize((320,250),Image.Resampling.LANCZOS)
img=ImageTk.PhotoImage(img)

img_lb.config(image=img)

img_lb.image=img

detail()

#Submit Button

SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0',
fg='black',command=mouseclick)

SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)

quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black',


command=root.destroy)

quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)

root.mainloop()

#search()
CRIMINAL DETAILS :-
from tkinter import*

from tkinter import ttk

import mysql.connector

import mysql.connector as c

def view():

t=Tk()

t.geometry("900x500")

t.title("All Criminals Details")

t.config(bg="gold")

con=c.connect(host="localhost",user="root",password="",port="3306",
database="criminal_db")

cur=con.cursor()

cur.execute("select * from criminal")

tree=ttk.Treeview(t)

tree['show'] = 'headings'

s = ttk.Style(t)
s.theme_use("clam")

s.configure("DLLs",font=('Helvetica',12))

s.configure("Treeview.Heading", foreground='red',font=('Helvetica',12,"bold"))

#Define no of columns

tree["columns"]=("id","name","dob","gender","age","adhar","phoneno","crimedo
ne","arrestdate","arrestingofficer")

#Assign the width,minwidth and anchor to the respective columns

tree.column("id",width=100,minwidth=100,anchor=CENTER)

tree.column("name",width=300,minwidth=300,anchor=CENTER)

tree.column("dob",width=100,minwidth=100,anchor=CENTER)

tree.column("gender",width=100,minwidth=100,anchor=CENTER)

tree.column("age",width=50,minwidth=50,anchor=CENTER)

tree.column("adhar",width=150,minwidth=150,anchor=CENTER)

tree.column("phoneno",width=150,minwidth=150,anchor=CENTER)

tree.column("crimedone",width=200,minwidth=200,anchor=CENTER)

tree.column("arrestdate",width=160,minwidth=160,anchor=CENTER)

tree.column("arrestingofficer",width=220,minwidth=220,anchor=CENTER)
#Assign the heading names to the respective columns

tree.heading("id",text="Criminal ID",anchor=CENTER)

tree.heading("name",text="FULL NAME",anchor=CENTER)

tree.heading("dob",text="DOB",anchor=CENTER)

tree.heading("gender",text="GENDER",anchor=CENTER)

tree.heading("age",text="AGE",anchor=CENTER)

tree.heading("adhar",text="ADHAR NO",anchor=CENTER)

tree.heading("phoneno",text="CONTACT NO",anchor=CENTER)

tree.heading("crimedone",text="CRIMEDONE",anchor=CENTER)

tree.heading("arrestdate",text="ARRESTING DATE",anchor=CENTER)

tree.heading("arrestingofficer",text="ARRESTING OFFICER",anchor=CENTER)

i=0

for ro in cur:

tree.insert('' ,i, text="",


values=(ro[0],ro[1],ro[3],ro[4],ro[5],ro[7],ro[10],ro[11],ro[12],ro[14]))

i = i +1

hsb = ttk.Scrollbar(t,orient="horizontal")

hsb.configure(command=tree.xview)

tree.configure(xscrollcommand=hsb.set)
hsb.pack(fill=X,side = BOTTOM)

tree.pack()

con.commit()

con.close()

#alldetail()

DELETE CRIMINAL:-
from tkinter import *

from PIL import ImageTk,Image

from tkinter import messagebox

import mysql.connector

import mysql.connector as c

con =
c.connect(host="localhost",user="root",password="",port="3306",database="cri
minal_db")

cur = con.cursor()

def deletecriminal():

bid = criminalInfo1.get()

deleteSql = "delete from criminal where bid = '"+bid+"'"

try:

cur.execute(deleteSql)

con.commit()

cur.execute(deleteIssue)

con.commit()
messagebox.showinfo('Success',"Book Record Deleted
Successfully",parent=root)

except:

messagebox.showinfo("Invalid Book ID",parent=root)

criminalInfo1.delete(0, END)

root.destroy()

def deleteCriminal():

global criminalInfo1,Canvas1,con,cur,criminal,root

root = Toplevel()

root.title("Library")

#root.minsize(width=400,height=400)

root.geometry("600x500+480+290")

Canvas1 = Canvas(root)

Canvas1.config(bg="DarkOrange1")

Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)

headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)

headingLabel = Label(headingFrame1, text="Delete Criminal Record",


bg='black', fg='white', font=('Courier',15))

headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)

labelFrame = Frame(root,bg='black')

labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)

# Book ID to Delete

lb2 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')

lb2.place(relx=0.05,rely=0.5)

criminalInfo1 = Entry(labelFrame)

criminalInfo1.place(relx=0.3,rely=0.5, relwidth=0.62)

#Submit Button

SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0',
fg='black',command=deletecriminal)

SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black',
command=root.destroy)

quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)

root.mainloop()

#deleteCriminal()
CONCLUSION
The purpose of face Recognition criminal identification
system is to identify criminal. In past years this process is
carried out by humans. This process gives the exact
image of the criminal but it is very difficult to identify the
criminal details and also it requires much amount of
human burden.
The main aim of our project is to over come
the drawbacks of human based system by using the
machine-based face identification process. In this process
we store the details of criminal into the database along
with his photo or image. Then we make the image into
different clips containing hair, forehead, eyes, nose, lips
and chin and store these clips into the database. When any
duplication occurs, we compare the details given by the
eyewitness with the clips already stored in the database
and we will identify the criminals. This project can be
extended to adjust the gaps between the clips after
construction of the image to be a perfect photograph using
Image processing Techniques.
BIBLIOGRAPHY

BOOKS REFERRED

The following books were used extensively for the project


development and implementation.

 Downey, Allen B. (May 2012). Think Python: How to


Think Like a Computer Scientist (Version 1.6.6 ed.).
 Lutz, Mark (2013). Learning Python (5th ed.). O'Reilly
Media.
 Pilgrim, Mark (2009). Dive into Python 3. Apress.
 Summerfield, Mark (2009). Programming in Python
3 (2nd ed.). Addison-Wesley Professional
WEBSITES REFERRED

The following links were searched and exploited


extensively for the project development and
implementation.

1. https://www.python.org/
2.https://www.w3schools.com/python/python_intro.a
sp
3.https://www.geeksforgeeks.org/python-
programming-language/

You might also like