Criminal Face Identification System Using Java and Mysql
Criminal Face Identification System Using Java and Mysql
U Nandini: 23XW5A0513
GUIDED BY
Swapna Mam
2023-2024
DECLARATION
Criminal face identification system hereby declares that the project entitled “Criminal face identification
system” submitted for B.Tech. (CSE) degree is the original work and the project is mainly aimed to store
the criminal details and to detect the criminal faces.
Place: Wanaparthy
We would like to thank our Head of the Department Dr.Asha jyothi Mam for the guidance and support
throughout the project. Their feedbacks have truly helped me improve and excel in this project.
We would like to express our special thanks to our Vice Principal Mr.Naresh Sir.
We would like to thank our principal Mr.N.S.Raju Sir, who helped me learn a lot about this project.His
ideas and comments aided in the completion of this project.I am grateful to the college administration
for providing me with such a significant chance.
INDEX
1.List of Symbols
2. Abstract
3. Introduction
4. Objectives
5. System Analysis
a. Existing System
b.Proposed System
6. System Requirements
a. Software Requirements
b.Hardware Requirements
5.System Design
b.Sequence Diagram
6. Coding
7.Testing
7.Output Screens
8. Conclusion
9. References
ABSTRACT
The project titled “Criminal face identification” has been Criminal record generally contains personal
information about particular person along with photograph. To identify any criminal, we need some
identification regarding person, which are given by eyewitnesses. In most cases the quality and
resolution of the recorded image-segments is poor and hard to identify a face. To overcome this sort of
problem we are developing software. Identification can be done in many ways like fingerprint, eyes,
DNA etc. One of the applications is face identification. The face is our primary focus of attention in
social inter course playing a major role in conveying identity and emotion. Although the ability to infer
intelligence or character from facial appearance is suspect, the human ability to recognize faces is
remarkable.
The operator first logs into the system by entering username and password. Then depending on the
work allotted he must select the screens from main menu screen. There are mainly three important
function which he can do they are adding details, clipping image and finally construction of the face by
using the eyewitness. The face that is finally formed is the one who has done the crime.
INTRODUCTION
Face Identification is a technique that is mainly used to identify criminals based on the clues
given by the eyewitnesses. Based on the clues we develop an image by using the image that we have in
our database and then we compare it with the images already we have. To identify any criminals, we
must have a record that generally contains name, age, location, previous crime, gender, photo, etc. The
primary task at hand is, given still or video images require the identification of the one or more
segmented and extracted from the scene, where upon it can be identified and matched. The word
“image is defined as” an exact or analogous representation of a being or thing.” The image or
monochrome image such as black and white paragraph is represented as two-dimensional lightintensity
function f (x, y) where x and y denote spatial co-ordinates. A digital image is an imageof f (x, y) that has
been digitized both in spatial co-ordinate and brightness. The elements of such a digital array are
called image elements, picture elements and pixels. This project is aimed to identify the criminals in any
investigation department. Here the technique is we already store some images of the criminals in our
database along with his details and that images are segmented into many slices say eyes, hairs, lips,
nose, etc. These images are again stored in another database record so to identify any criminals;
eyewitnesses will see the images or slices that appear on the screen by using it we develop the face,
which may or may not be matched with our images. If any image is matched up to 99% then we predict
that he is only the criminal. Thus, using this project, it provides a very friendly environment for both
operator and eyewitness to easily design any face can identify criminals very easy.
OBJECTIVES
To overcome the drawbacks of human based system by using the machine- based face identification
process. Another aspect of the project includes, developing a model which if trained on given
criminal record dataset can predict the face sketch of a criminal based upon features fed as input by a
witness. 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. To develop a database of
images that could be used a source for comparison with the image obtained from the previous pane.
The system can be used to identify criminals without the need of sketching and description. It also
eliminates fake report of accusing someone. In the field of cyber security, the proposed system can be
used for detecting criminals easily.
SYSTEM ANALYSIS
Existing System:
This system is manual system only. Here, have a facility to store the criminal images. If you want to
compare the criminal images with the existing images it is manual process. This process is very slow to
give the result. It is very critical to find the criminal images.
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 and calculate maximum number of slices of the
similar record number. Based on this record number the program retrieves the personal record of the
suspect (whose slice constituted the major parts of the constructed human face) on exercising the locate
option.
SYSTEM REQUIREMENTS
HARDWARE REQUIREMENTS
• Processor: Minimum 1GHz
SOFTWARE REQUIREMENTS
• Windows 11
• JAVA 21
• Eclipse IDE
• My-SQL Database.
USE CASE DESCRIPTION:
Use Case diagrams are one of the five diagrams in the UML for modeling the dynamic aspects of systems
(activity diagrams, sequence diagrams, state chart diagrams and collaboration diagrams are the four
other kinds of diagrams in the UML for modeling the dynamic aspects of systems). Use Case diagrams
are central to modeling the behavior of the system, a sub-system, or a class. Each one shows a set of use
cases and actors and relationships.
Typically, you place the object that initiates the interaction at the left, and increasingly more sub-
routine objects to the right. Next, you place the messages that these objects send and receive along
the Y-axis, in order of increasing time from top to the bottom. This gives the reader a clear visual cue to
the flow of control over time.
1. There is the object lifeline. An object lifeline is the vertical dashed line that represents the existence
of an object over a period of time. Most objects that appear in the interaction diagrams will be in
existence for the duration of the interaction, so these objects are all aligned at the top of the diagram,
with their lifelines drawn from the top of the diagram to the bottom.
2. There is a focus of the control. The focus of control is tall, thin rectangle that shows the
period of time during which an object is performing an action, either directly or through the
subordinate procedure. The top of the rectangle aligns with the action;the bottom is aligned with its
completion.
DATA FLOW DIAGRAM :
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
Coding
CriminalDetails.java
package com.criminalidentification;
// ...
return criminalId;
}
public void setCriminalId(int criminalId) {
this.criminalId = criminalId;
return firstName;
this.firstName = firstName;
return lastName;
this.lastName = lastName;
return aliasName;
}
public void setAliasName(String aliasName) {
this.aliasName = aliasName;
return dob;
this.dob = dob;
return age;
this.age = age;
return gender;
return address;
this.address = address;
return city;
this.city = city;
return state;
this.state = state;
}
return arrestedDate;
this.arrestedDate = arrestedDate;
return crimeInvolved;
this.crimeInvolved = crimeInvolved;
return image;
this.image = image;
}
}
CriminalDetailsDAO
package com.criminalidentification;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
while (rs.next()) {
criminal.setCriminalId(rs.getInt("criminal_id"));
criminal.setFirstName(rs.getString("first_name"));
criminal.setLastName(rs.getString("last_name"));
criminal.setAliasName(rs.getString("alias_name"));
criminal.setDob(rs.getString("dob"));
criminal.setAge(rs.getInt("age"));
criminal.setGender(rs.getString("gender"));
criminal.setAddress(rs.getString("address"));
criminal.setCity(rs.getString("city"));
criminal.setState(rs.getString("state"));
criminal.setArrestedDate(rs.getString("arrested_date"));
criminal.setCrimeInvolved(rs.getString("crime_involved"));
criminal.setImage(rs.getBytes("image"));
criminals.add(criminal);
return criminals;
String query = "INSERT INTO criminal_details (first_name, last_name, alias_name, dob, age, gender,
address, city, state, arrested_date, crime_involved, image) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
pstmt.setString(1, criminal.getFirstName());
pstmt.setString(2, criminal.getLastName());
pstmt.setString(3, criminal.getAliasName());
pstmt.setString(4, criminal.getDob());
pstmt.setInt(5, criminal.getAge());
pstmt.setString(6, criminal.getGender());
pstmt.setString(7, criminal.getAddress());
pstmt.setString(8, criminal.getCity());
pstmt.setString(9, criminal.getState());
pstmt.setString(10, criminal.getArrestedDate());
pstmt.setString(11, criminal.getCrimeInvolved());
pstmt.setBytes(12, criminal.getImage());
pstmt.executeUpdate();
pstmt.setInt(1, id);
if (rs.next()) {
criminal.setCriminalId(rs.getInt("criminal_id"));
criminal.setFirstName(rs.getString("first_name"));
criminal.setLastName(rs.getString("last_name"));
criminal.setAliasName(rs.getString("alias_name"));
criminal.setDob(rs.getString("dob"));
criminal.setAge(rs.getInt("age"));
criminal.setGender(rs.getString("gender"));
criminal.setAddress(rs.getString("address"));
criminal.setCity(rs.getString("city"));
criminal.setState(rs.getString("state"));
criminal.setArrestedDate(rs.getString("arrested_date"));
criminal.setCrimeInvolved(rs.getString("crime_involved"));
criminal.setImage(rs.getBytes("image"));
return criminal;
DATABASE CONNECTION
package com.criminalidentification;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
private static final String USER = "root"; // Replace with your MySQL username
private static final String PASSWORD = "root"; // Replace with your MySQL password
public static Connection getConnection() throws SQLException {
MAIN.JAVA
package com.criminalidentification;
import java.sql.SQLException;
import java.util.List;
import java.util.Scanner;
criminal.setFirstName(scanner.nextLine());
criminal.setLastName(scanner.nextLine());
criminal.setDob(scanner.nextLine());
criminal.setAge(scanner.nextInt());
criminal.setGender(scanner.nextLine());
criminal.setAddress(scanner.nextLine());
criminal.setCity(scanner.nextLine());
criminal.setState(scanner.nextLine());
criminal.setArrestedDate(scanner.nextLine());
try {
dao.addCriminalDetails(criminal);
} catch (SQLException e) {
e.printStackTrace();
} finally {
scanner.close();
CRIMINALDETAILSFORM.JAVA
package com.criminalidentification.gui;
import com.criminalidentification.CriminalDetails;
import com.criminalidentification.CriminalDetailsDAO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
public CriminalDetailsForm() {
setLayout(new BorderLayout());
panel.add(cmbCriminalId);
panel.add(txtLastName);
panel.add(txtAliasName);
panel.add(new JLabel("D.O.B:"));
panel.add(txtDob);
panel.add(new JLabel("Age:"));
panel.add(txtAge);
panel.add(new JLabel("Gender:"));
panel.add(txtGender);
panel.add(new JLabel("Address:"));
panel.add(txtAddress);
panel.add(new JLabel("City:"));
panel.add(txtCity);
panel.add(new JLabel("State:"));
panel.add(txtState);
panel.add(txtArrestedDate);
panel.add(txtCrimeInvolved);
panel.add(new JLabel("Image:"));
panel.add(lblImagePath);
panel.add(btnSelectImage);
panel.add(btnSubmit);
panel.add(btnClose);
add(panel, BorderLayout.CENTER);
btnClear.addActionListener(new ActionListener() {
@Override
clearForm();
});
btnClose.addActionListener(new ActionListener() {
@Override
setVisible(false);
}
});
btnSubmit.addActionListener(new ActionListener() {
@Override
submitForm();
});
btnSelectImage.addActionListener(new ActionListener() {
@Override
selectImage();
});
cmbCriminalId.addActionListener(new ActionListener() {
@Override
if (selectedId != null) {
loadCriminalDetails(selectedId);
});
loadCriminalIds();
txtFirstName.setText("");
txtLastName.setText("");
txtAliasName.setText("");
txtDob.setText("");
txtAge.setText("");
txtGender.setText("");
txtAddress.setText("");
txtCity.setText("");
txtState.setText("");
txtArrestedDate.setText("");
txtCrimeInvolved.setText("");
lblImagePath.setText("");
selectedImageFile = null;
try {
cmbCriminalId.removeAllItems();
for (CriminalDetails criminal : criminals) {
cmbCriminalId.addItem(criminal.getCriminalId());
} catch (SQLException e) {
e.printStackTrace();
try {
if (criminal != null) {
txtFirstName.setText(criminal.getFirstName());
txtLastName.setText(criminal.getLastName());
txtAliasName.setText(criminal.getAliasName());
txtDob.setText(criminal.getDob());
txtAge.setText(String.valueOf(criminal.getAge()));
txtGender.setText(criminal.getGender());
txtAddress.setText(criminal.getAddress());
txtCity.setText(criminal.getCity());
txtState.setText(criminal.getState());
txtArrestedDate.setText(criminal.getArrestedDate());
txtCrimeInvolved.setText(criminal.getCrimeInvolved());
} catch (SQLException e) {
e.printStackTrace();
if (result == JFileChooser.APPROVE_OPTION) {
selectedImageFile = fileChooser.getSelectedFile();
lblImagePath.setText(selectedImageFile.getAbsolutePath());
try {
criminal.setFirstName(txtFirstName.getText());
criminal.setLastName(txtLastName.getText());
criminal.setAliasName(txtAliasName.getText());
criminal.setDob(txtDob.getText());
criminal.setAge(Integer.parseInt(txtAge.getText()));
criminal.setGender(txtGender.getText());
criminal.setAddress(txtAddress.getText());
criminal.setCity(txtCity.getText());
criminal.setState(txtState.getText());
criminal.setArrestedDate(txtArrestedDate.getText());
criminal.setCrimeInvolved(txtCrimeInvolved.getText());
if (selectedImageFile != null) {
criminal.setImage(imageData);
} catch (IOException e) {
e.printStackTrace();
dao.addCriminalDetails(criminal);
clearForm();
} catch (SQLException e) {
e.printStackTrace();
CRIMINALIDENTIFICATIONFORM.JAVA
package com.criminalidentification.gui;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import com.criminalidentification.CriminalDetails;
import com.criminalidentification.CriminalDetailsDAO;
public CriminalIdentificationForm() {
setLayout(new BorderLayout());
panel.add(lblSelectedImage);
panel.add(btnSelectImage);
txtCriminalDetails.setEditable(false);
panel.add(new JScrollPane(txtCriminalDetails));
panel.add(btnIdentify);
add(panel, BorderLayout.CENTER);
btnSelectImage.addActionListener(new ActionListener() {
@Override
selectImage();
});
btnIdentify.addActionListener(new ActionListener() {
@Override
identifyCriminal();
});
if (result == JFileChooser.APPROVE_OPTION) {
selectedImageFile = fileChooser.getSelectedFile();
if (selectedImageFile != null) {
if (identifiedCriminal != null) {
// Display criminal details in text area
displayCriminalDetails(identifiedCriminal);
} else {
txtCriminalDetails.setText("");
ex.printStackTrace();
} else {
try {
byte[] storedImage = criminal.getImage(); // Get the stored image bytes from the database
if (Arrays.equals(imageData, storedImage)) {
return criminal;
}
}
} catch (SQLException e) {
e.printStackTrace();
return null;
Loginform.java
package com.criminalidentification.gui;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public LoginForm() {
setLayout(new BorderLayout());
panel.add(new JLabel("Username:"));
panel.add(txtUsername);
panel.add(new JLabel("Password:"));
panel.add(txtPassword);
btnLogin = new JButton("Login");
panel.add(btnLogin);
add(panel, BorderLayout.CENTER);
btnLogin.addActionListener(new ActionListener() {
@Override
if (authenticate(username, password)) {
MainApplication.showMainApplicationWindow();
} else {
});
// For demo purposes, let's assume username: admin and password: admin
Mainapplication.java
package com.criminalidentification.gui;
import javax.swing.*;
SwingUtilities.invokeLater(new Runnable() {
@Override
showLoginForm();
});
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setSize(600, 400);
mainFrame.setLocationRelativeTo(null);
mainFrame.getContentPane().add(loginForm);
mainFrame.setVisible(true);
mainFrame.getContentPane().removeAll();
mainFrame.getContentPane().add(tabbedPane);
mainFrame.revalidate();
mainFrame.repaint();
mainapplicationWindow.java
package com.criminalidentification.gui;
import javax.swing.*;
import java.awt.*;
public MainApplicationWindow() {
setSize(600, 600);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
add(cardPanel);
}
cardLayout.show(cardPanel, formName);
SwingUtilities.invokeLater(new Runnable() {
@Override
window.setVisible(true);
});
showMainApplicationWindow();
}
TESTING:
TESTING STRATEGY ADAPTED :
The completion of a system is achieved only after it has been thoroughly tested. Though this gives a
feel the project is completed, there cannot be any project without going through this stage. Though the
programmer may have taken many precautions not to commit any mistakes that crop up during the
execution stage. Hence in this stage it is decided whether the project can undergo the real time
environment execution without any break downs, therefore a package can be rejected even at this
stage. The testing phase involves the testing of the developed system using various kinds of data. An
elaborated testing of data is prepared and a system is tested using the test data. While testing, errors
are noted and corrections remade, the corrections are also noted for future use.
SYSTEM TESTING :
Testing is a set of activities that can be planned in advance and conducted systematically. The proposed
system is tested in parallel with the software that consists of its own phases of analysis, implementation,
testing and maintenance. Following are the tests conducted on the system.
UNIT TESTING :
During the implementation of the system each module of the system was tested separately to uncover
errors within its boundaries. User interface was used as a guide in the process.
MODULE TESTING:
A module is composed of various programs related to that module. Module testing is done to check the
module functionality and interaction between units within a module. It checks the functionality of
each program with relation to other programs within the same module. It then tests the overall
functionality of each module.
CONCLUSION :
The purpose of face identification system is to identify criminals. 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 overcome 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 crime occurs we compare the
details given by the eyewitness with the clips already stored in the database and we will identify the
criminal. 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.
REFERENCES:
The following links were searched and exploited extensively for the project development and
implementation:
1. http://www.java.sun.com/products\java
2. http://www.jakarta.apache.org
3. http://www.javaworld.com/
4. http://www.java2s.com/
5. http://www.academia.education.in
6. https://aip.scitation.org
7. https://www.sciencedirect.com
8. https://ieeexplore.ieee.org
9. https://learn.g2.com
10. https://lib.dr.iastate.edu