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

Criminal Face Identification System Using Java and Mysql

Uploaded by

tefitef101
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)
344 views51 pages

Criminal Face Identification System Using Java and Mysql

Uploaded by

tefitef101
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/ 51

CRIMINAL FACE IDENTIFICATION SYSTEM USING JAVA+DBMS

REAL TIME PROJECT


SUBMITTED BY

Karabandi Nikitha: 22XW1A0526

U Nandini: 23XW5A0513

Kummari Kalyani: 22XW1A0531

Kundarapu Mahesh: 22XW1A0532

GUIDED BY

Swapna Mam

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

JNTUH COLLEGE OF ENGINEERING WANAPARTHY

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

Date: 22/06/2024 Signature of the student


ACKNOWLEDGEMENT
We would like to express our special thank of gratitude to our guide Swapna Mam, who gave us
opportunity to do this wonderful project on Criminal Face Identification System.

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

a. Use Case Diagram

b.Sequence Diagram

c.Data Flow 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

• Main Memory: 2GB RAM

• Hard Disk: Minimum 2 GB

• Processor: Pentium III – 900 MHz

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.

USE CASE DIAGRAM:


.
SEQUENCE DIAGRAM:
A sequence diagram is an interaction diagram that emphasizes the time ordering of the
messages. Graphically, a sequence diagram is a table that shows objects arranged along the X-axis
and messages, ordered in increasing time, along the Y-axis.

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.

Sequence diagrams have two interesting features:

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;

public class CriminalDetails {

private int criminalId;

private String firstName;

private String lastName;

private String aliasName;

private String dob;

private int age;

private String gender;

private String address;

private String city;

private String state;

private String arrestedDate;

private String crimeInvolved;

private byte[] image;

// Getters and setters for all fields

// ...

public int getCriminalId() {

return criminalId;

}
public void setCriminalId(int criminalId) {

this.criminalId = criminalId;

public String getFirstName() {

return firstName;

public void setFirstName(String firstName) {

this.firstName = firstName;

public String getLastName() {

return lastName;

public void setLastName(String lastName) {

this.lastName = lastName;

public String getAliasName() {

return aliasName;

}
public void setAliasName(String aliasName) {

this.aliasName = aliasName;

public String getDob() {

return dob;

public void setDob(String dob) {

this.dob = dob;

public int getAge() {

return age;

public void setAge(int age) {

this.age = age;

public String getGender() {

return gender;

public void setGender(String gender) {


this.gender = gender;

public String getAddress() {

return address;

public void setAddress(String address) {

this.address = address;

public String getCity() {

return city;

public void setCity(String city) {

this.city = city;

public String getState() {

return state;

public void setState(String state) {

this.state = state;
}

public String getArrestedDate() {

return arrestedDate;

public void setArrestedDate(String arrestedDate) {

this.arrestedDate = arrestedDate;

public String getCrimeInvolved() {

return crimeInvolved;

public void setCrimeInvolved(String crimeInvolved) {

this.crimeInvolved = crimeInvolved;

public byte[] getImage() {

return image;

public void setImage(byte[] image) {

this.image = image;

}
}

CriminalDetailsDAO

package com.criminalidentification;

import java.sql.*;

import java.util.ArrayList;

import java.util.List;

public class CriminalDetailsDAO {

private Connection getConnection() throws SQLException {

String url = "jdbc:mysql://localhost:3306/criminaldb";

String user = "root";

String password = "root";

return DriverManager.getConnection(url, user, password);

public List<CriminalDetails> getAllCriminalDetails() throws SQLException {

List<CriminalDetails> criminals = new ArrayList<>();

String query = "SELECT * FROM criminal_details";

try (Connection conn = getConnection(); Statement stmt = conn.createStatement(); ResultSet rs =


stmt.executeQuery(query)) {

while (rs.next()) {

CriminalDetails criminal = new CriminalDetails();

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;

public void addCriminalDetails(CriminalDetails criminal) throws SQLException {

String query = "INSERT INTO criminal_details (first_name, last_name, alias_name, dob, age, gender,
address, city, state, arrested_date, crime_involved, image) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

try (Connection conn = getConnection(); PreparedStatement pstmt =


conn.prepareStatement(query)) {

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();

public CriminalDetails getCriminalDetailsById(int id) throws SQLException {

CriminalDetails criminal = null;

String query = "SELECT * FROM criminal_details WHERE criminal_id=?";

try (Connection conn = getConnection(); PreparedStatement pstmt =


conn.prepareStatement(query)) {

pstmt.setInt(1, id);

try (ResultSet rs = pstmt.executeQuery()) {

if (rs.next()) {

criminal = new CriminalDetails();

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;

public class DatabaseConnection {

private static final String URL = "jdbc:mysql://localhost:3306/CriminalDB";

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 {

return DriverManager.getConnection(URL, USER, PASSWORD);

MAIN.JAVA

package com.criminalidentification;

import java.sql.SQLException;

import java.util.List;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

CriminalDetailsDAO dao = new CriminalDetailsDAO();

CriminalDetails criminal = new CriminalDetails();

Scanner scanner = new Scanner(System.in);

// Read input from the user

System.out.print("Enter First Name: ");

criminal.setFirstName(scanner.nextLine());

System.out.print("Enter Last Name: ");

criminal.setLastName(scanner.nextLine());

System.out.print("Enter Alias Name: ");


criminal.setAliasName(scanner.nextLine());

System.out.print("Enter DOB (yyyy-mm-dd): ");

criminal.setDob(scanner.nextLine());

System.out.print("Enter Age: ");

criminal.setAge(scanner.nextInt());

scanner.nextLine(); // consume the newline

System.out.print("Enter Gender: ");

criminal.setGender(scanner.nextLine());

System.out.print("Enter Address: ");

criminal.setAddress(scanner.nextLine());

System.out.print("Enter City: ");

criminal.setCity(scanner.nextLine());

System.out.print("Enter State: ");

criminal.setState(scanner.nextLine());

System.out.print("Enter Arrested Date (yyyy-mm-dd): ");

criminal.setArrestedDate(scanner.nextLine());

System.out.print("Enter Crime Involved: ");


criminal.setCrimeInvolved(scanner.nextLine());

try {

dao.addCriminalDetails(criminal);

List<CriminalDetails> criminals = dao.getAllCriminalDetails();

for (CriminalDetails c : criminals) {

System.out.println("ID: " + c.getCriminalId() + ", Name: " + c.getFirstName() + " " +


c.getLastName());

} 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 class CriminalDetailsForm extends JPanel {

private static final long serialVersionUID = 1L;

private JTextField txtFirstName, txtLastName, txtAliasName, txtDob, txtAge, txtGender, txtAddress,


txtCity, txtState, txtArrestedDate, txtCrimeInvolved;

private JComboBox<Integer> cmbCriminalId;

private JButton btnClear, btnClose, btnSubmit, btnSelectImage;

private JLabel lblImagePath;

private File selectedImageFile;

public CriminalDetailsForm() {

setLayout(new BorderLayout());

JPanel panel = new JPanel(new GridLayout(16, 2, 10, 10));

panel.add(new JLabel("Criminal Id:"));

cmbCriminalId = new JComboBox<>();

panel.add(cmbCriminalId);

panel.add(new JLabel("First Name:"));

txtFirstName = new JTextField();


panel.add(txtFirstName);

panel.add(new JLabel("Last Name:"));

txtLastName = new JTextField();

panel.add(txtLastName);

panel.add(new JLabel("Alias Name:"));

txtAliasName = new JTextField();

panel.add(txtAliasName);

panel.add(new JLabel("D.O.B:"));

txtDob = new JTextField();

panel.add(txtDob);

panel.add(new JLabel("Age:"));

txtAge = new JTextField();

panel.add(txtAge);

panel.add(new JLabel("Gender:"));

txtGender = new JTextField();

panel.add(txtGender);

panel.add(new JLabel("Address:"));

txtAddress = new JTextField();

panel.add(txtAddress);
panel.add(new JLabel("City:"));

txtCity = new JTextField();

panel.add(txtCity);

panel.add(new JLabel("State:"));

txtState = new JTextField();

panel.add(txtState);

panel.add(new JLabel("Arrested Date:"));

txtArrestedDate = new JTextField();

panel.add(txtArrestedDate);

panel.add(new JLabel("Crime Involved:"));

txtCrimeInvolved = new JTextField();

panel.add(txtCrimeInvolved);

panel.add(new JLabel("Image:"));

lblImagePath = new JLabel();

panel.add(lblImagePath);

btnSelectImage = new JButton("Select Image");

panel.add(btnSelectImage);

btnClear = new JButton("Clear");


panel.add(btnClear);

btnSubmit = new JButton("Submit");

panel.add(btnSubmit);

btnClose = new JButton("Close");

panel.add(btnClose);

add(panel, BorderLayout.CENTER);

// Event listeners for buttons

btnClear.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

clearForm();

});

btnClose.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

// Handle close action, e.g., navigate to main application window

// or disable the form

setVisible(false);

}
});

btnSubmit.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

submitForm();

});

btnSelectImage.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

selectImage();

});

cmbCriminalId.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

Integer selectedId = (Integer) cmbCriminalId.getSelectedItem();

if (selectedId != null) {

loadCriminalDetails(selectedId);

});
loadCriminalIds();

private void clearForm() {

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;

private void loadCriminalIds() {

try {

CriminalDetailsDAO dao = new CriminalDetailsDAO();

List<CriminalDetails> criminals = dao.getAllCriminalDetails();

cmbCriminalId.removeAllItems();
for (CriminalDetails criminal : criminals) {

cmbCriminalId.addItem(criminal.getCriminalId());

} catch (SQLException e) {

e.printStackTrace();

private void loadCriminalDetails(int criminalId) {

try {

CriminalDetailsDAO dao = new CriminalDetailsDAO();

CriminalDetails criminal = dao.getCriminalDetailsById(criminalId);

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());

// Load image if necessary


}

} catch (SQLException e) {

e.printStackTrace();

private void selectImage() {

JFileChooser fileChooser = new JFileChooser();

int result = fileChooser.showOpenDialog(this);

if (result == JFileChooser.APPROVE_OPTION) {

selectedImageFile = fileChooser.getSelectedFile();

lblImagePath.setText(selectedImageFile.getAbsolutePath());

private void submitForm() {

try {

CriminalDetails criminal = new CriminalDetails();

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) {

try (FileInputStream fis = new FileInputStream(selectedImageFile)) {

byte[] imageData = fis.readAllBytes();

criminal.setImage(imageData);

} catch (IOException e) {

e.printStackTrace();

CriminalDetailsDAO dao = new CriminalDetailsDAO();

dao.addCriminalDetails(criminal);

JOptionPane.showMessageDialog(this, "Criminal details added successfully!");

clearForm();

} catch (SQLException e) {

e.printStackTrace();

JOptionPane.showMessageDialog(this, "Error adding criminal details.");

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 class CriminalIdentificationForm extends JPanel {

private static final long serialVersionUID = 1L;

private JLabel lblSelectedImage;

private JButton btnSelectImage, btnIdentify;

private JTextArea txtCriminalDetails;

private File selectedImageFile;

public CriminalIdentificationForm() {
setLayout(new BorderLayout());

JPanel panel = new JPanel(new GridLayout(4, 1, 10, 10));

lblSelectedImage = new JLabel("Selected Image:");

panel.add(lblSelectedImage);

btnSelectImage = new JButton("Select Image");

panel.add(btnSelectImage);

txtCriminalDetails = new JTextArea();

txtCriminalDetails.setEditable(false);

panel.add(new JScrollPane(txtCriminalDetails));

btnIdentify = new JButton("Identify");

panel.add(btnIdentify);

add(panel, BorderLayout.CENTER);

// Event listeners for buttons

btnSelectImage.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

selectImage();

});
btnIdentify.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

identifyCriminal();

});

private void selectImage() {

JFileChooser fileChooser = new JFileChooser();

int result = fileChooser.showOpenDialog(this);

if (result == JFileChooser.APPROVE_OPTION) {

selectedImageFile = fileChooser.getSelectedFile();

lblSelectedImage.setText("Selected Image: " + selectedImageFile.getName());

private void identifyCriminal() {

if (selectedImageFile != null) {

try (FileInputStream fis = new FileInputStream(selectedImageFile)) {

byte[] imageData = fis.readAllBytes();

// Call method to compare image data with database entries

CriminalDetails identifiedCriminal = identifyFromDatabase(imageData);

if (identifiedCriminal != null) {
// Display criminal details in text area

displayCriminalDetails(identifiedCriminal);

} else {

JOptionPane.showMessageDialog(this, "Criminal Not Identified.");

txtCriminalDetails.setText("");

} catch (IOException ex) {

ex.printStackTrace();

} else {

JOptionPane.showMessageDialog(this, "Please select an image first.");

private CriminalDetails identifyFromDatabase(byte[] imageData) {

try {

CriminalDetailsDAO dao = new CriminalDetailsDAO();

List<CriminalDetails> criminals = dao.getAllCriminalDetails(); // Fetch all criminals from database

for (CriminalDetails criminal : criminals) {

byte[] storedImage = criminal.getImage(); // Get the stored image bytes from the database

// Compare the input imageData with storedImage

if (Arrays.equals(imageData, storedImage)) {

// If images match, return the identified criminal

return criminal;

}
}

} catch (SQLException e) {

e.printStackTrace();

// If no match found, return null (criminal not identified)

return null;

private void displayCriminalDetails(CriminalDetails criminal) {

// Method to display criminal details in txtCriminalDetails

txtCriminalDetails.setText("Details of the identified criminal:\n\n");

txtCriminalDetails.append("Criminal ID: " + criminal.getCriminalId() + "\n");

txtCriminalDetails.append("Name: " + criminal.getFirstName() + " " + criminal.getLastName() + "\


n");

txtCriminalDetails.append("Date of Birth: " + criminal.getDob() + "\n");

txtCriminalDetails.append("Age: " + criminal.getAge() + "\n");

txtCriminalDetails.append("Gender: " + criminal.getGender() + "\n");

txtCriminalDetails.append("Address: " + criminal.getAddress() + ", " + criminal.getCity() + ", " +


criminal.getState() + "\n");

txtCriminalDetails.append("Arrested Date: " + criminal.getArrestedDate() + "\n");

txtCriminalDetails.append("Crime Involved: " + criminal.getCrimeInvolved() + "\n");

// Add more details as needed

Loginform.java

package com.criminalidentification.gui;
import javax.swing.*;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

public class LoginForm extends JPanel {

private static final long serialVersionUID = 1L;

private JTextField txtUsername;

private JPasswordField txtPassword;

private JButton btnLogin;

public LoginForm() {

setLayout(new BorderLayout());

JPanel panel = new JPanel(new GridLayout(3, 2, 10, 10));

panel.add(new JLabel("Username:"));

txtUsername = new JTextField();

panel.add(txtUsername);

panel.add(new JLabel("Password:"));

txtPassword = new JPasswordField();

panel.add(txtPassword);
btnLogin = new JButton("Login");

panel.add(btnLogin);

add(panel, BorderLayout.CENTER);

// Event listener for login button

btnLogin.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

String username = txtUsername.getText();

String password = new String(txtPassword.getPassword());

// Implement your authentication logic here

if (authenticate(username, password)) {

JOptionPane.showMessageDialog(LoginForm.this, "Login Successful!");

// Navigate to the main application window

MainApplication.showMainApplicationWindow();

} else {

JOptionPane.showMessageDialog(LoginForm.this, "Invalid Username or Password");

});

private boolean authenticate(String username, String password) {


// Implement your authentication logic here

// For demo purposes, let's assume username: admin and password: admin

return username.equals("admin") && password.equals("admin");

Mainapplication.java

package com.criminalidentification.gui;

import javax.swing.*;

public class MainApplication {

private static JFrame mainFrame;

public static void main(String[] args) {

SwingUtilities.invokeLater(new Runnable() {

@Override

public void run() {

showLoginForm();

});

private static void showLoginForm() {

mainFrame = new JFrame("Criminal Identification System");

mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setSize(600, 400);

mainFrame.setLocationRelativeTo(null);

LoginForm loginForm = new LoginForm();

mainFrame.getContentPane().add(loginForm);

mainFrame.setVisible(true);

public static void showMainApplicationWindow() {

mainFrame.getContentPane().removeAll();

JTabbedPane tabbedPane = new JTabbedPane();

CriminalDetailsForm criminalDetailsForm = new CriminalDetailsForm();

tabbedPane.addTab("Criminal Details", criminalDetailsForm);

CriminalIdentificationForm criminalIdentificationForm = new CriminalIdentificationForm();

tabbedPane.addTab("Criminal Identification", criminalIdentificationForm);

mainFrame.getContentPane().add(tabbedPane);

mainFrame.revalidate();

mainFrame.repaint();

mainapplicationWindow.java
package com.criminalidentification.gui;

import javax.swing.*;

import java.awt.*;

public class MainApplicationWindow extends JFrame {

private static final long serialVersionUID = 1L;

private CardLayout cardLayout;

private JPanel cardPanel;

public MainApplicationWindow() {

setTitle("Criminal Identification System");

setSize(600, 600);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setLocationRelativeTo(null);

cardLayout = new CardLayout();

cardPanel = new JPanel(cardLayout);

cardPanel.add(new LoginForm(), "LoginForm");

cardPanel.add(new CriminalDetailsForm(), "CriminalDetailsForm");

cardPanel.add(new CriminalIdentificationForm(), "CriminalIdentificationForm");

add(cardPanel);
}

public void showForm(String formName) {

cardLayout.show(cardPanel, formName);

public static void showMainApplicationWindow() {

SwingUtilities.invokeLater(new Runnable() {

@Override

public void run() {

MainApplicationWindow window = new MainApplicationWindow();

window.setVisible(true);

});

public static void main(String[] args) {

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

You might also like