0% found this document useful (0 votes)
7 views73 pages

Mini Project Final Report Grp-11

The document presents a mini project report on an Online Voting System with Face Recognition, developed by students at Mar Baselios Institute of Technology and Science for their Bachelor of Technology in Computer Science and Engineering. The system aims to enhance the voting process by providing a secure, efficient, and transparent method for conducting elections, utilizing modern web technologies and biometric authentication. Key features include real-time voting monitoring, automated vote tallying, and user-friendly accessibility, while addressing limitations such as internet dependency and potential cyber threats.

Uploaded by

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

Mini Project Final Report Grp-11

The document presents a mini project report on an Online Voting System with Face Recognition, developed by students at Mar Baselios Institute of Technology and Science for their Bachelor of Technology in Computer Science and Engineering. The system aims to enhance the voting process by providing a secure, efficient, and transparent method for conducting elections, utilizing modern web technologies and biometric authentication. Key features include real-time voting monitoring, automated vote tallying, and user-friendly accessibility, while addressing limitations such as internet dependency and potential cyber threats.

Uploaded by

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

MAR BASELIOS INSTITUTE OF TECHNOLOGY AND SCIENCE

NELLIMATTOM P.O, KOTHAMANGALAM, KERALA

APJ ABDULKALAM TECHNOLOGICAL UNIVERSITY


THIRUVANANTHAPURAM

CSD334-MINI PROJECT REPORT

ONLINE VOTING SYSTEM WITH FACE RECOGNITION

Submitted by

JOVITTA PAUL (MBI22CS073)


PRISCILLA VINOD (MBI22CS099)
SREELAKSHMI AJI (MBI22CS114)
SANIYA BENNY (MBI22CS106)

In partial fulfillment for the award of the degree


of
BACHELOR OF TECHNOLOGY

COMPUTER SCIENCE AND ENGINEERING


APRIL2025

i
MAR BASELIOS INSTITUTE OF TECHOLOGY AND SCIENCE
NELLIMATTOM P.O, KOTHAMANGALAM, KERALA

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

BONAFIDE CERTIFICATE

This is to certify that the report on ONLINE VOTING SYSTEM is a bonafide record of
Mini Project presented by JOVITTA PAUL (MBI22CS073), PRISCILLA VINOD
(MBI22CS099), SANIYA BENNY (MBI22CS106), SREELAKSHMI AJI
(MBI22CS114) in partial fulfillment of requirements for the award of the degree of Bachelor
of Technology in Computer Science and Engineering of APJ Abdul Kalam
Technological University, Thiruvananthapuram during the academic year 2024- 2025.

Project Guide Project Coordinator Head of the Department


Prof. Sreedevi R Prof. Bini V C Prof. Bonia Jose
Assistant Professor Assistant Professor Associate Professor
Department of CSE Department of CSE Department of CSE

INTERNAL EXAMINER EXTERNAL EXAMINER

ii
ACKNOWLEDGEMENT

First and foremost, We thank ALMIGHTY GOD who gave us the inner strength, resource
and ability to complete our work successfully, without which all our efforts would have been
in vain.

We sincerely thank Dr. Thomas George, our principal for providing the facilities and support
that enabled the successful completion of this phase of the project.

We express our deep sense of gratitude to Prof. Bonia Jose, HOD In-charge of Computer
Science and Engineering for her insightful comments, encouragements and critical inquiries,
which inspired us to widen our project from various perspectives. We would like to extend our
gratitude to Prof. Bini V C, Assistant Professor, CSE Department for the creative suggestions,
valuable advices, mental support and guidance as project coordinator.

Words are insufficient to express our heartfelt and sincere gratitude to our guide who have
suggested a relevant and interesting project topic and paved the way to the successful
completion of this phase of the project. With great respect and gratitude, We acknowledge our
guide Prof. Sreedevi R, Assistant Professor, Department of CSE for her valuable guidance,
great inspiration and moral support throughout the period of our project work. We are indebted
to her for the valuable time she has spared throughout this work.

We use this opportunity to thank all faculties in the department and the friends who have
helped us to complete the project, with their inspiration and cooperation.

Jovitta Paul (MBI22CS073)


Priscilla Vinod (MBI22CS099)
Saniya Benny (MBI22CS106)
Sreelakshmi Aji (MBI22CS114)

iii
ABSTRACT

The Online Voting System is a web-based platform designed to provide a secure, efficient, and
transparent method for conducting elections. Traditional voting methods, including paper ballots
and electronic voting machines, often face challenges such as security vulnerabilities, logistical
inefficiencies, and accessibility barriers. To address these issues, this system leverages modern
web technologies and biometric authentication using face recognition. The system consists of two
main modules: the User Module, where registered voters can authenticate themselves and cast
their votes, and the Admin Module, which facilitates election setup, candidate management, and
result monitoring. The integration of face recognition technology ensures that only legitimate
users can participate, reducing the risks of fraud and impersonation. The system also automates
vote tallying and result generation, minimizing human errors and ensuring accuracy. Developed
using CSS, HTML, JavaScript, Python django, OpenCV, and SQLITE3, the platform is
designed for scalability and can be deployed for various types of elections. Key features include
real-time voting monitoring, secure authentication, encrypted vote storage, and user-friendly
accessibility. While the system enhances security and efficiency, it has some limitations, such as
internet dependency, potential cyber threats, and face recognition accuracy variations.
However, with proper implementation, it offers a cost-effective, reliable, and modernized
approach to voting, making elections more accessible and trustworthy. This project aims to
contribute to the advancement of digital democracy, ensuring a fair and transparent voting
experience while addressing the limitations of conventional electoral systems.

iv
TABLE OF CONTENTS

ACKNOWLEDGEMENT iii
ABSTRACT iv
LIST OF FIGURES vii
LIST OF TABLES viii
ABBREVIATIONS ix
1. INTRODUCTION 10
1.1 Background and motivation 10
1.2 Proposed system 11
1.3 Project scope 12
1.3.1 Limitations and existing system 13
1.3.2 Advantages of proposed system 14
2. SYSTEM ANALYSIS 16
2.1 Introduction 16
2.2 Stakeholders of the Project 17
2.2.1 Admin 17
2.2.2 Users 17
2.3 Feasibility Study 18
2.4 Software Development Lifecycle Model 20
2.5 Hardware and Software requirements 21
2.5.1 Software Specifications 21
2.5.2 Hardware Requirements 27
3. SYSTEM DESIGN 28
3.1 System Architecture 28
3.2 Module Design 28
3.3 Database Design 29
3.3.1 Tables 30
3.3.2 Introduction to Data Flow Diagrams 32
3.3.3 Data Flow Diagram 34
3.3.4 ER Diagram 35
3.3.5 Use Case Diagram 36

v
4. IMPLEMENTATION 38
4.1 Sample Code 39
5. TESTING 53
5.1 Test Cases 53
5.1.1 Unit Testing 54
5.1.2 Integration Testing 55
5.1.3 Black Box Testing 55
5.1.4 White Box Testing 56
5.1.5 Validation Testing 57
5.1.6 User Acceptance Testing 57
5.2 Test Case Documents 58
6. CONCLUSION 60
6.1 Future Enhancements 60
REFERENCES 63
APPENDIX 64

vi
Online Voting System

LIST OF FIGURES

Fig. No. Title Page No.

5.1 Zeroth level Data Flow Diagram 31

5.2 First Level Data Flow Diagram 31

5.3 Second Level Data Flow Diagram 32

5.4 ER Diagram 32

7.1 Use Case Diagram 33

Department of Computer Science and Engineering,MBITS 7


Online Voting System

LIST OF TABLES

Table No. Title PageNo.

7.2 Election 27

7.3 Vote 27

7.4 Candidate 28

7.5 Voter 28

7.6 User 28

Department of Computer Science and Engineering,MBITS 8


Online Voting System

LIST OF ABBREVIATIONS

SDLC Software DeveLopment Life Cycle

SQL Structured Query Language

NLP Natural Language Processing

EVMS Electronic Voting Machine

DFD Data Flow Diagram

HTTP Hyper Text Transfer Protocol

Department of Computer Science and Engineering,MBITS 9


Online Voting System

CHAPTER 1
INTRODUCTION

1.1 BACKGROUND AND MOTIVATION

The traditional voting process has long been the backbone of democratic systems, ensuring
fair and legitimate elections. However, traditional voting methods, such as paper ballots and
electronic voting machines, often present challenges such as long queues, logistical
inefficiencies, risks of fraud, and human error. With advancements in technology, online
voting systems have emerged as a viable alternative to enhance efficiency, security, and
accessibility.
The Online Voting System proposed in this project leverages modern web technologies and
facial recognition to create a seamless and secure voting experience. Developed using
HTML, CSS, JavaScript, OpenCV, and Python django,SQLITE3 this system ensures that
only authorized users can cast their votes, reducing the risks of fraud and unauthorized access.

The motivation behind developing this online voting system stems from several key factors:

⚫ Enhanced Security: Traditional voting systems are prone to issues such as vote
tampering, impersonation, and double voting. The integration of face recognition
technology ensures that only legitimate voters can cast their votes, thus minimizing
electoral fraud.

⚫ Improved Accessibility: Many people face challenges when participating in elections


due to physical disabilities, geographical barriers, or time constraints. A web-based
voting platform allows eligible voters to participate remotely, increasing voter turnout
and engagement.

⚫ Efficiency and Accuracy: Manual vote counting is often time-consuming and


susceptible to human errors. This system automates the voting and tallying process,
ensuring quicker and more accurate results.

⚫ Transparency and Trust: By allowing real-time vote monitoring and result tracking, the
system increases transparency and trust among voters and election organizers.

Department of Computer Science and Engineering,MBITS 10


Online Voting System

⚫ Cost-effectiveness: Conducting elections via online platforms significantly reduces the


costs associated with printed ballots, polling stations, and workforce deployment.

1.2 PROPOSED SYSTEM

System Description:

The Voting Management System will consist of two primary modules: User Module and
Admin Module. Users can authenticate using face recognition and cast their votes, while
admins can create and manage elections, view results, and monitor the voting process.

Features & Functionality:

⚫ Face Recognition Login: Users authenticate using their facial features captured via
webcam.

⚫ User Dashboard: A user can view available elections and cast their vote.

⚫ Vote Casting: After successful authentication, users can vote for candidates or options in
an election.

⚫ Admin Dashboard: Admins can create elections, add candidates/options, and view real-
time election results.

⚫ Result Management: Automatic tallying of votes and displaying results after the voting
period ends.

Technologies Used:

⚫ Frontend: HTML, CSS, JavaScript.

⚫ Backend: Python django and SQLITE3 for database management and processing.

⚫ Face Recognition Integration: OpenCV and Python for real-time authentication.

Security Measures: Data encryption and secure authentication mechanisms to prevent


unauthorized access.

Advantages of the Proposed System

Department of Computer Science and Engineering,MBITS 11


Online Voting System

⚫ Enhanced Security: The face recognition system prevents unauthorized users from
voting.
⚫ User-Friendly Interface: A well-designed and intuitive dashboard ensures ease of use.
⚫ Real-time Monitoring: Admins can oversee elections and intervene if necessary.
⚫ Scalability: The system can be deployed for various types of elections, from institutional
voting to governmental elections.
⚫ Transparency & Accuracy: The automated tallying and verification process reduces
human errors and increases election integrity.By implementing this system, the voting
process can be modernized while maintaining high security, transparency, and ease of
use for both voters and administrators

1.3 Project scope

The scope of this Online Voting System project encompasses the design, development, and
deployment of a secure and efficient web-based platform for conducting elections. The
system aims to provide a user-friendly experience for both voters and administrators while
ensuring high levels of security and transparency.

OBJECTIVES

To develop a web-based online voting platform that allows registered users to cast their
votes remotely. To integrate face recognition technology for secure user authentication and
fraud prevention. To automate the vote counting and result generation process for efficiency
and accuracy. To provide real-time election monitoring for administrators. To ensure the
system is scalable, allowing it to be used for different types of elections, such as institutional,
organizational, or governmental elections.

Functional Scope

⚫ User Features:

⚫ User registration and login.


⚫ Secure authentication using face recognition.
⚫ Cast votes in real time.

Department of Computer Science and Engineering,MBITS 12


Online Voting System

⚫ View election results (if permitted).


⚫ Admin Features:
⚫ Manage voter registrations and authentication.
⚫ Set up and configure elections, including candidate registration.
⚫ Monitor the voting process in real time.
⚫ Manage and publish election results.

Technical Scope

⚫ Frontend Development: HTML, CSS, JavaScript.


⚫ Backend Development: Python django, SQLITE3 for data storage and management.
⚫ Face Recognition Integration: OpenCV and Python for biometric authentication.
⚫ Security Measures: Data encryption, access control, and secure session management.

1.3.1 LIMITATIONS & EXISTING SYSTEMS

Limitations

⚫ Requires a stable internet connection for access.


⚫ Face recognition accuracy depends on lighting and camera quality.
⚫ Initial database setup and user registration must be managed manually by
administrators.

1. Election Guard

⚫ It uses homomorphic encryption to allow vote tallying without decrypting individual


ballots.
⚫ ElectionGuard can be integrated with existing voting systems and provides voters
with a tracking code to verify their vote was counted correctly.
2. Voatz
⚫ Voatz is a mobile voting platform that uses blockchain technology
⚫ It also uses biometric verifications
⚫ It allows voters to cast ballots remotely using smartphones.

Department of Computer Science and Engineering,MBITS 13


Online Voting System

⚫ The system has been used in pilot programs for military and overseas voters in several
U.S. states and for party conventions
3. Democracy Live

⚫ Democracy Live offers OmniBallot, a cloud-based ballot delivery and return system.
⚫ It's designed to be accessible across multiple devices and has been used in over 1,000
elections across the U.S.
⚫ The platform focuses particularly on accessibility for voters with disabilities and those
serving overseas.

1.3.2 Advantages of proposed system

⚫ User Experience Focus: It shows detailed user interaction steps including profile
management, candidate selection, and vote confirmation. ElectionGuard is more of a
backend verification technology and doesn't prescribe specific user experience elements.

⚫ Dashboard functionality: Your system includes dashboard features for viewing


statistics and managing candidates, which extends beyond the pure voting mechanics that
ElectionGuard proviFdes.

⚫ Result Transparency: Your system appears to include result viewing and statistics
components, making election results more immediately accessible than ElectionGuard's
verification system which requires technical knowledge to interpret.

⚫ Reduced Hardware Dependencies: Unlike Voatz, which requires specific smartphone


capabilities for biometric authentication, your system seems to rely on more standard
verification methods that would work across a wider range of devices.

⚫ Transparency in Process Flow: Our project explicitly shows the vote casting,
verification, and confirmation steps, creating a more transparent process for users. Voatz
has been criticized for its lack of transparency in how votes are processed and verified.

⚫ User Control Features: Your system includes user profile management and the ability
to view personal voting statistics, giving voters more agency and information about
their participation than voatz typically provide.

Department of Computer Science and Engineering,MBITS 14


Online Voting System

CHAPTER 2

SYSTEM ANALYSIS

2.1 Introduction

Elections play a vital role in democratic societies, ensuring that citizens can exercise their
right to vote and choose their representatives. However, traditional voting methods, such as
paper ballots and electronic voting machines (EVMs), come with various challenges,
including security vulnerabilities, logistical inefficiencies, and accessibility barriers. To
address these concerns, online voting systems have emerged as a modern solution, offering
enhanced security, convenience, and efficiency.

The proposed Online Voting System with Face Recognition aims to provide a secure and
transparent platform for conducting elections. By integrating biometric authentication
through face recognition technology, the system ensures that only eligible voters can
participate, minimizing the risks of fraud and impersonation. This approach enhances election
integrity by preventing unauthorized access and multiple voting attempts.

The system consists of two primary modules: the User Module and the Admin Module. The
User Module allows voters to register, authenticate using facial recognition, and cast their
votes securely. The Admin Module enables election management, candidate registration,
real-time monitoring, and automated result tallying.

Developed using CSS, JavaScript, Bootstrap, OpenCV, SQLITE3 and Python django,
this web-based platform ensures ease of access and scalability. Security measures such as
data encryption, user authentication, and real-time monitoring further strengthen the integrity
of the system.

This project aims to modernize the electoral process by providing a secure, efficient, and
accessible voting platform. With its advanced authentication features, automated processing,
and user-friendly interface, the system contributes to the evolution of digital democracy,
making elections more reliable and transparent.

Department of Computer Science and Engineering,MBITS 15


Online Voting System

2.2 STAKE HOLDERS OF THE PROJECT

2.1.1 ADMIN

⚫ System Administrator: Responsible for overall system management, security, and


maintenance.

⚫ Election Officials: Handle voter registration, set up elections, and oversee the voting
process.
⚫ Technical Support Team: Ensures system functionality, resolves technical issues, and
updates software.
⚫ Security Team: Monitors and prevents cyber threats, ensuring data integrity and secure
access.
⚫ Database Administrators: Manage voter databases, election data, and ensure backup
and recovery mechanisms.
⚫ Auditors and Compliance Officers: Verify the election process, ensuring transparency
and adherence to regulations.
⚫ Government or Institutional Supervisors: Oversee the system to ensure it aligns with
legal and ethical standards.

2.1.2 USERS

⚫ Registered Voters: Users who register, verify their identity through face recognition,
and cast their votes.
⚫ User Support Team: Provides assistance to voters facing technical or authentication
issues.
⚫ Election Monitors: Ensure fair and smooth voting operations, assisting users if
necessary.
⚫ System Interface Designers: Responsible for creating an accessible and user-friendly
voting experience.
⚫ Legal and Compliance Officers: Ensure that users' rights are protected and that the
voting process complies with regulations.

Department of Computer Science and Engineering,MBITS 16


Online Voting System

⚫ Data Privacy Officers: Protect user data and ensure that personal information remains
confidential and secure.

2.3 FEASIBILITY STUDY

The feasibility of the project is analyzed in this phase and business proposal is put forth with
a very general plan for the project and some cost estimates. During system analysis the
feasibility study of the proposed system is to be carried out. This is to ensure that the
proposed system is not a burden to the company. For feasibility analysis, some understanding
of the major requirements for the system is essential.

Three key considerations involved in the feasibility analysis are:

⚫ ECONOMICAL FEASIBILITY

⚫ TECHNICAL FEASIBILITY

⚫ OPERATIONAL FEASIBILITY

⚫ LEGAL AND ETHICAL FEASIBILITY

ECONOMICAL FEASIBILITY

⚫ Initial development costs include software, server hosting, and biometric authentication
setup.

⚫ Reduced costs compared to traditional election methods (paper ballots, polling stations,
and logistics).

⚫ Cost savings in the long run due to automation and reduced manpower requirements.

TECHNICAL FEASIBILITY

⚫ The system is developed using CSS, JavaScript, Bootstrap, SQLITE3, OpenCV, and
Python django, which are widely used and well-supported technologies.

⚫ Face recognition technology ensures high security and user authentication, leveraging
OpenCV and deep learning models.

⚫ The system requires a stable internet connection and camera access for face recognition.

Department of Computer Science and Engineering,MBITS 17


Online Voting System

⚫ Objective: To determine if the required technology and expertise are available to build
and maintain the system.

⚫ Technology Requirements:
The system requires the following technologies:
⚫ Backend: Python (Django Framework) for server-side processing.
⚫ Frontend: HTML, CSS, Bootstrap for the user interface.
⚫ Database: SQLite3 for database management and storage.
⚫ Face Recognition: OpenCV and Python for integrating face recognition technology for
voter authentication.
⚫ Web Interface: JavaScript for capturing webcam images for face recognition.
⚫ System Infrastructure:
The system will require a web server for hosting the application and a database server
for managing voter, candidate, and election data. The users will access the system
through their web browsers on personal devices (computers or smartphones).
⚫ Security Considerations:
Security is a key concern, especially when handling sensitive data like facial recognition
images and voter credentials. The system will use:
⚫ Encryption: SSL/TLS encryption for secure data transmission.
⚫ Two-factor authentication (2FA): To add an extra layer of security for voter
registration and login.
⚫ Firewall and Intrusion Detection Systems: To monitor and secure the system from
external threats.
⚫ Hardware Requirements:
⚫ For Admin: A computer or laptop with an internet connection.
⚫ For Users (Voters and Candidates): Any device with a webcam for facial recognition
and internet access.
⚫ Feasibility:
Given the availability of required technologies, software frameworks, and the increasing
development in face recognition algorithms, the system is technically feasible.

Department of Computer Science and Engineering,MBITS 18


Online Voting System

OPERATIONAL FEASIBILITY

⚫ The system is user-friendly, providing an intuitive interface for voters and administrators.
⚫ Secure authentication eliminates fraud and enhances election integrity.
⚫ Administrators can efficiently manage elections with automated result tallying and
monitoring.

LEGAL AND ETHICAL FEASIBILITY

⚫ The system must comply with data privacy laws such as the GDPR and local election
regulations.
⚫ Voter data security and confidentiality are ensured through encryption and access
controls.
⚫ Ethical considerations include providing access to all eligible voters and preventing bias
in face recognition models.

2.4 SOFTWARE DEVELOPEMENT LIFECYCLE MODEL

The development of the Online Voting System with Face Recognition follows the
Waterfall SDLC Model, ensuring a structured and sequential development process. The
key phases include:

1. Requirement Analysis:

Identifying system requirements, including user authentication, database management, and


security measures.Conducting feasibility studies to assess technical, economic, and
operational viability.

2. System Design:

Designing the system architecture, database schema, and user interface.Planning security
measures such as encryption and authentication.

3. Implementation:

Department of Computer Science and Engineering,MBITS 19


Online Voting System

Developing the system using CSS, SQLITE3, JavaScript, OpenCV, and Python django.
Integrating face recognition for voter authentication.

4. Testing:

Conducting unit testing, integration testing, and system testing.Identifying and fixing
security vulnerabilities and functional errors.

5. Deployment:

Hosting the system on a server and making it accessible to users.Ensuring scalability and
performance optimization.

6. Maintenance and Updates:

Regular system updates to enhance security and functionality.Monitoring system


performance and addressing user feedback

The Waterfall Model is chosen due to its structured approach, ensuring each phase is
completed before progressing to the next. This model ensures a reliable and secure voting
system with well-defined requirements and comprehensive testing before deployment.

2.5 HARDWARE & SOFTWARE REQUIRMENTS

2.5.1 SOFTWARE SPECIFICATIONS

Front End: HTML, CSS,JS


Back End: SQLITE3 ,Python Django
IDE: VS CODE
Interface: Web Browser (Preferred Google Chrome).
Modules :OpenCV
Software used:Build tools, c++, cmake

HTML

Department of Computer Science and Engineering,MBITS 20


Online Voting System

HTML, or Hypertext Markup Language, serves as the backbone of the World Wide Web,
providing a standardized way to create and structure web pages. It consists of a series of
elements, each enclosed within tags, which define the content and layout of a webpage.
HTML elements range from basic elements like paragraphs (<p>), headings (<h1> to <h6>),
and links (<a>), to more complex elements like tables (<table>), forms (<form>), and
multimedia embeds (<img>, <audio>,<video>). It employs a hierarchical structure to
organize content, allowing developers to nest elements within each other to create complex
page layouts.

For example, a <div> element can contain multiple other elements, enabling developers to
group and organize content sections. Additionally, HTML attributes provide additional
information about elements, modifying their behavior or appearance. Attributes like "src" in
an <img> tag specify the source URL of an image, while the "href" attribute in an <a> tag
defines the destination URL of a hyperlink.

HTML5, the latest version of HTML, introduced several new features and elements to
enhance web development capabilities. Semantic elements such as <header>, <footer>,
<nav>, and <article> provide clearer structure and meaning to web pages, improving
accessibility and search engine optimization. HTML5 also introduced native support for
multimedia elements like <audio> and <video>, allowing developers to embed rich media
content directly into web pages without relying on third-party plugins. Additionally, HTML5
introduced new form input types like email, tel, and date, making it easier to create user-friendly
and interactive web forms.

CSS

CSS is a style sheet language used for describing the presentation of a document written in a
markup language. Although most often used to set the visual style of web pages and user
interfaces written in HTML and XHTML, the language can be applied to any XML
document, including plain XML, SVG andXUL, and is applicable to rendering in speech, or
on other media. Along with HTML and JavaScript, CSS is a cornerstone technology used
by most websites to create visually engaging webpages, user interfaces for web applications,
and user interfaces for many mobile applications.

Department of Computer Science and Engineering,MBITS 21


Online Voting System

This separation of formatting and content makes it possible to present the same markup
page in different styles for different rendering methods, such as on-screen, in print, by voice
(when read out by a speech-based browser orscreen reader) and on Braille-based, tactile
devices. It can also be used to display the web page differently depending on the screen size
or device on which it is being viewed. Although the author of a web page typically links to a
CSS file within the markup file, readers can specify a different style sheet, such as a CSS
file stored on their own computer, to override the one the author has specified. If the author
or the reader did not link the document to a style sheet, the default style of the browser will
be applied. Another advantage of CSS is that aesthetic changes to the graphic design of a
document (or hundreds of documents) can be applied quickly and easily, by editing a few
lines in one file, rather than by a laborious (and thus expensive) process of crawling over
every document line by line, changing markup.

JAVASCRIPT

JavaScript plays a crucial role in an online voting system by enhancing interactivity, ensuring
real-time data validation, and improving the overall user experience. It is used to create
dynamic and responsive interfaces, allowing voters to easily navigate through the system,
select candidates, and submit their votes seamlessly. JavaScript, often combined with
frameworks like React or Vue.js, helps in managing client-side functionalities such as form
validation, preventing multiple submissions, and displaying instant feedback messages.
Additionally, JavaScript can be integrated with AJAX to communicate with the server
asynchronously, ensuring real-time vote updates without requiring page reloads. Security
measures, such as input sanitization and CAPTCHA implementation, can also be enforced
using JavaScript to prevent automated voting or malicious activities. Moreover, it enables
encryption techniques like JSON Web Tokens (JWT) for secure authentication and
authorization of voters. In summary, JavaScript enhances the efficiency, security, and
usability of an online voting system by providing a seamless, real-time, and interactive
voting experience

SQLITE3

SQLite3 is a lightweight, self-contained, serverless, and zero-configuration relational

Department of Computer Science and Engineering,MBITS 22


Online Voting System

database management system (RDBMS) designed for efficiency and ease of use. Unlike
traditional databases such as MySQL or PostgreSQL, SQLite does not require a separate
server process and operates directly from a single database file stored on disk. This makes it
an excellent choice for embedded systems, mobile applications, and lightweight desktop
software. One of SQLite’s key advantages is its minimal footprint, with the entire library
being less than 1MB in size, making it ideal for resource-constrained environments like IoT
devices and mobile phones. Additionally, SQLite is ACID-compliant, ensuring reliable
transactions and data integrity even in cases of system crashes or power failures. It supports
a wide range of SQL operations,SQLite performs exceptionally well in applications that
require quick data retrieval, such as web browsers, where it is used to store history, cookies,
and cache (e.g., in Google Chrome and Mozilla Firefox). Moreover, its ease of integration
and low memory usage make it a preferred choice for mobile applications like WhatsApp
and other local storage-based apps. However, despite its advantages, SQLite is not suitable
for high-concurrency, large-scale applications, as it supports limited write operations and
lacks built-in user authentication and access control. Nevertheless, for small to medium-sized
applications that require a simple, reliable, and portable database solution, SQLite remains a
highly efficient and widely adopted choice.

Python django
Django is a high-level Python web framework that enables rapid development and clean,
pragmatic design for web applications. It follows the Model-View-Template (MVT)
architectural pattern, providing developers with a structured and scalable approach to building
web applications. Django comes with a built-in Object-Relational Mapping (ORM) system,
allowing seamless interaction with databases without writing complex SQL queries. It also
includes an admin panel, authentication system, and security features such as protection
against SQL injection, cross-site scripting (XSS), and cross-site request forgery (CSRF). One
of Django’s key strengths is its “batteries-included” philosophy, which means it provides a
comprehensive set of tools and libraries needed for web development, reducing the need for
third-party dependencies. It supports multiple databases, including SQLite, PostgreSQL,
MySQL, and Oracle, making it flexible for various applications. Django is widely used for
building scalable web applications, ranging from small projects to large platforms like
Instagram, Pinterest, and Mozilla. With its emphasis on reusability, rapid development,
Department of Computer Science and Engineering,MBITS 23
Online Voting System

and security, Django is a preferred choice for developers who want to build robust,
maintainable, and high-performance web applications.

VS CODE

Visual Studio Code (VS Code) is a lightweight but robust source code editor created by
Microsoft, catering to developers across different platforms including Windows, macOS, and
Linux. Its user-friendly interface offers features like split views, tabbed editing, and a
minimap, facilitating efficient navigation within large files. Notably, VS Code integrates Git
support seamlessly, enabling version control operations within the editor itself, eliminating
the need for a separate Git client. This built-in functionality allows developers to manage
diffs, stage changes, commit code, and perform other Git operations effortlessly.

One of the most compelling aspects of VS Code is its extensive ecosystem of extensions
available through the VS Code Marketplace. These extensions enhance productivity by
providing additional language support, framework integration, debugging tools, and themes.
Furthermore, VS Code's IntelliSense feature offers context-aware code completion,
significantly expediting coding tasks by suggesting variables, functions, and methods
as Developers type. Debugging is another area where VS Code excels, offering built-in
support for debugging various programming languages and platforms. Developers can set
breakpoints, inspect variables, and step through code directly within the editor, streamlining
the troubleshooting process. Additionally, VS Code features an integrated terminal,
empowering developers to execute command-line tools, scripts, and shell commands
without leaving the editor environment. The terminal can be customized and configured to
meet specific workflow requirements, enhancing developer productivity.

Web Browser

It acts as an intermediary between users and web servers, interpreting HTML, CSS,
JavaScript, and other web technologies to render web pages in a user-friendly format. The
primary functions of a web browser include rendering web content, navigating between web
pages, and executing scripts to enable interactivity.

Department of Computer Science and Engineering,MBITS 24


Online Voting System

Web browsers provide a graphical user interface (GUI) that allows users to interact with web
content through features such as buttons, menus, and toolbars. They typically include a URL
bar for entering web addresses, navigation buttons for moving backward and forward through
browsing history, and tabs for multitasking by opening multiple web pages simultaneously.

Modern web browsers offer a wide range of features and functionalities to enhance the
browsing experience. These include support for bookmarks and favorites, which allow users
to save and organize frequently visited websites for easy access. Additionally, web browsers
often include built-in search engines, enabling users to perform web searches directly from
the browser interface.

Security is a significant concern for web browsers, given the sensitive nature of online
activities such as banking, shopping, and communication. To protect users from security
threats like malware, phishing, and data breaches, web browsers implement various security
features such as sandboxing, encryption, and built-in security protocols like HTTPS.

Compatibility with web standards and technologies is also essential for web browsers to
ensure consistent and reliable rendering of web content across different devices and platforms.
Browser vendors regularly release updates and patches to address security vulnerabilities,
improve performance, and add support for new web technologies, ensuring that users have
access to a secure efficient, and feature-rich browsing experience.

OpenCV

OpenCV (Open Source Computer Vision Library) is a widely used open-source library for
computer vision, image processing, and machine learning. It provides a vast collection of
functions and algorithms that enable tasks such as object detection, facial recognition, motion
tracking, and image enhancement. Written primarily in C++ and supporting multiple
programming languages like Python and Java, OpenCV is optimized for real-time
applications, making it popular in robotics, artificial intelligence, and automation. It supports
various platforms, including Windows, Linux, macOS, and mobile operating systems.
OpenCV is extensively used in research and industry for applications ranging from medical

Department of Computer Science and Engineering,MBITS 25


Online Voting System

imaging to self-driving cars, owing to its efficiency, scalability, and ease of integration with
deep learning frameworks

2.5.2 HARDWARE SPECIFICATIONS

The selection of hardware configuring is a very task related to the software development,
particularly inefficient RAM may affect adversely on the speed and corresponding on the
efficiency of the entire system. The processor should be powerful to handle all the operations.
The hard disk should have the sufficient to solve the database and the application.

Minimum Hardware Required for Implementation:


CPU : Pentium V Processor

Memory : 8GB

Cache : 512 KB Above

Hard Disk : 500 GB

Monitor : Any

Keyboard : Any

Mouse : Any
SoC : I3 8th above

Department of Computer Science and Engineering,MBITS 26


Online Voting System

CHAPTER 3

SYSTEM DESIGN

3.1 SYSTEM ARCHITECTURE


The ‘Online Voting System With Face Recognition’ consist of mainly three modules namely
user, admin and face recognition. The three modules are responsible to carry out all the
functions and activities of admin, user and face recognition respectively. Since the
functionalities of each module is specially arranged and developed the error occurrence rate is
low and only need to verify the respective module to correct if any error occurred.

3.2 MODULE DESIGN

USER MODULE:

⚫ Authentication: Users log in using face recognition via a webcam. The system captures
the user’s face and compares it with stored facial data.
⚫ Voting: After authentication, users can view available elections and cast their votes.
⚫ Result Viewing: Users can see real-time election results if permitted.

ADMIN MODULE:

⚫ Election Management: Admins can create elections, set voting parameters (dates,
candidates, etc.), and manage users.
⚫ Vote Monitoring: Admins can monitor voting in real-time, check the number of votes
cast, and stop the election when the time expires.
⚫ Result Tallying: The system automatically counts votes and displays the final results
after voting ends

FACE RECOGNITION:

Department of Computer Science and Engineering,MBITS 27


Online Voting System

⚫ Face Data Capture: The system captures the user's face through a camera and
compares it with stored data.

⚫ Authentication: The user is authenticated based on facial features before being allowed
to vote.

This system integrates SQLITE3, OpenCV, and Python django for backend processing
and HTML, CSS, JavaScript, for the frontend.

3.3 DATABASE DESIGN

A database is a collection of interrelated data stored with minimum redundancy to serve many
users quickly and efficiently. The general objective is to make information access easy, quick,
inexpensive and flexible for the users. The general theme behind a database is to integrate all
information. Database design is recognized as a standard of management information system
and is available virtually for every computer system. In database design several specific
objectives are considered:

• Ease of learning and use

• Controlled redundancy

• Data independence

• More information at low cost

• Accuracy and integrity.

• Recovery from failure

• Privacy and security

• Performance

A database is an integrated collection of data and provides centralized access to the data.
Usually, the centralized data managing the software is called RDBMS. The main significant
difference between RDBMS and other DBMS is the separation of data as seen by the

Department of Computer Science and Engineering,MBITS 28


Online Voting System

program and data has in direct access to stores device. This is the difference between logical
and physical data.

3.3.1 TABLES

Election

Vote

Department of Computer Science and Engineering,MBITS 29


Online Voting System

Candidate

Voter

User

Department of Computer Science and Engineering,MBITS 30


Online Voting System

3.3.2 INTRODUCTION TO DATAFLOW DIAGRAMS

Data Flow Diagram is a network that describes the flow of data and processes that change, or
transform, data throughout the system. This network is constructed by use a set of ymbols
that do not imply a physsical implementation. It is a graphical tool for structul analysis
of the system requirements. DFD models a system by using external entities from which data
flows to a process, which transforms the data and creates, output-data-flows which go to other
processes or external entities or files. Data in files may also flow to processes as inputs. There
are various symbols used in a DFD. Bubbles represent the processes. Named arrows indicate
the data flow. External entities are represented by rectangles. Entities supplying data are
known as sources and those that consume data are called sinks. Data are stored in a data store
by a process in the system. Each component in a DFD is labelled with a descriptive name.
Process names are further identified with a number. The Data Flow Diagram shows the
logical flow of a system and defines the boundaries of the system. For a candidate system, it
describes the input (source), outputs (destination), database (files) and procedures (data flow),
all in a format that meet the user’s requirements.

The main merit of DFD is that it can provide an overview of system requirements, what data a
system would process, what transformations of data are done, what files are used, and where
the results flow. This network is constructed by use a set of symbols that do not imply a
physical implementation. It is a graphical tool for structured analysis of the system
requirements. DFD models a system by using external entities from which data flows to a
process, which transforms the data and creates, output-data-flows which go to other processes
or external entities or files. External entities are represented by rectangles. Entities supplying
data are known as sources and those that consume data are called sinks. Data are stored in a
data store by a process in the system. It is a graphical tool for structured analysis of the system
requirements. DFD models a system by using external entities from which data flows to a
process, which transforms the data and creates, output-data-flows which go to other processes
or external entities or files. Data in files may also flow to processes as inputs.
Rules for constructing a Data Flow Diagram:

Department of Computer Science and Engineering,MBITS 31


Online Voting System

1. Arrows should not cross each other


2. Squares, circles and files must bear names.
3. Decomposed data flow squares and circles can have same time
4. Choose meaningful names for data flow
Basic Data Flow Diagram Symbols

A data flow is a route, which


enables packets of data to
travel from one point to
another. Data may flow from
a source to a process and
from data store or process.
An arrow line depicts the
flow, with arrowhead
pointing in the direction of
the flow.
Circles stands for process
that converts data in to
information. A process
represents transformation
where incoming data flows
are changed into outgoing
data flows.

Department of Computer Science and Engineering,MBITS 32


Online Voting System

A data store is a repository of


data that is to be stored for
use by a one or more process
may be as simple as buffer or
queue or sophisticated as
relational database. They
should have clear names. If a
process merely uses the
content of store and does not
alter it, the arrowhead goes
only from the store to the
process. If a process alters
the details in the store, then a
double-headed arrow is used.

A source or sink is a person


or part of an organization,
which enters or receives
information from the
system, but is outside
the contest of data flow
model.

3.3.3 DATA FLOW DIAGRAM

LEVEL 0

Department of Computer Science and Engineering,MBITS 33


Online Voting System

LEVEL 1

LEVEL 2

Department of Computer Science and Engineering,MBITS 34


Online Voting System

3.3.4 ER DIAGRAM

Department of Computer Science and Engineering,MBITS 35


Online Voting System

3.3.5 USE CASE DIAGRAM

Department of Computer Science and Engineering,MBITS 36


Online Voting System

3.4 INTERFACE DESIGN

These modules can apply to hardware, software or the interface between a user and a machine.
An example of a user interface could include a GUI, a control panel for a nuclear power plant,
or even the cockpit of an aircraft. N systems engineering, all the inputs and outputs of a system,
subsystem, and its components are listed in an interface control document often as part of the
requirements of the engineering project. The development of a user interface is a unique field.

3.4.1 USER INTERFACE SCREEN DESIGN

The user interface design is very important for any application. The interface design
describes how the software communicates within itself, to system that interpreted with it and
with humans who use it. The input design is the process of converting the user- oriented inputs
into the computer- based format. The data is fed into the system using simple inactive forms.
The forms have been supplied with messages so that the user can enter data without facing any
difficulty. They data is validated wherever it requires in the project. This ensures that only the
correct data have been incorporated into system. The goal of designing input data is to make
the automation as easy and free from errors as possible. For providing a good input design for
the application easy data input and selection features are adopted. The input design
requirements such as user friendliness, consistent format, and interactive dialogue for giving
the right messages and help for the user at right are also considered for development for this
project. Input Design is a part of the overall design. The basic steps involved in input design
are:
• Review input requirements.

• Decide how the input data flow will be implemented.

• Decide the source document.

• Prototype on line input screens.

Department of Computer Science and Engineering,MBITS 37


Online Voting System

CHAPTER 4

IMPLEMENTATION
IDE: VISUAL STUDIO CODE

Visual Studio Code is a streamlined code editor with support for development operations like
debugging, task running, and version control. It aims to provide just the tools a developer
needs for a quick code-build-debug cycle and leaves more complex workflows to fuller
featured IDE. Developers are highly opinionated when it comes to code editors. Visual
Studio Code is free, open- source, and cross-platform. This means that it works on
Windows, Linux, and macOS. Unlike many other code editors, Visual Studio Code has an
in-built debugger, making the development flow less ‘clicky’ and maintains a single view
with code and debugger. This makes the process of bug tracking, and code run-throughs a
lot easier and faster. You do not need to have multiple screens to run the different consoles
and rearrange them each time you need to minimize something. It’s built into the design and
your desired workspace set up.

DATABASE: SQLITE3

SQLite3 is a lightweight, self-contained, serverless SQL database engine that is widely


used for embedded systems, mobile applications, and small to medium-sized websites.
Unlike traditional database management systems that require a server to run, SQLite3
operates directly within the application, storing the entire database as a single file on the
device. This makes it incredibly easy to set up and manage, as there’s no need for complex
configurations or separate database servers.

One of the key strengths of SQLite3 is its simplicity. It doesn’t require any installation or
maintenance, and the database is accessed through a standard SQL interface. This makes it an ideal
choice for applications that need to store data locally, such as mobile apps, desktop
applications, or even IoT devices. Despite its lightweight nature, SQLite3 supports a wide range of
SQL features, including transactions, sub-selects, triggers, and views, which allows developers to
build robust and feature-rich applications.

Department of Computer Science and Engineering,MBITS 38


Online Voting System

SQLite3 is also highly efficient in terms of performance. It’s designed to handle high-
speed read operations, making it suitable for applications where quick data retrieval is
critical. However, it may not be the best choice for applications that require heavy write
operations or complex multi-user concurrency, as it doesn’t support advanced client-server
features found in larger database systems. Nonetheless, its ease of use, portability, and
reliability make it a popular choice for many developers around the world.

4.1 SAMPLE CODE

==================FUNCTION====================================

import
os

import
tempfile
from django.shortcuts import render, redirect,
get_object_or_404 from django.contrib.auth import login,
authenticate, logout
from django.contrib.auth.decorators import
login_required from django.contrib import
messages
from django.utils import
timezone from django.http
import JsonResponse
from django.views.decorators.csrf import
csrf_exempt from django.core.files.base
import ContentFile import base64

from .models import Voter, Candidate, Election, Vote

from .forms import UserRegistrationForm, VoterRegistrationForm, CandidateForm,


ElectionForm

Department of Computer Science and Engineering,MBITS 39


Online Voting System

from .face_detection import get_face_encoding, verify_face, detect_faces_webcam

def home(request):

active_elections = Election.objects.filter(is_active=True, end_date


gt=timezone.now()) return render(request, 'voting/home.html', {'elections':
active_elections})

def register(request):

if request.method == 'POST':

user_form =
UserRegistrationForm(request.POST) if
user_form.is_valid():
user = user_form.save()
============================= Create voter profile=================

Voter.objects.create(user=user)

messages.success(request, 'Registration successful. Please log in and register


your face.') return redirect('login')
else:

user_form = UserRegistrationForm()
return render(request, 'voting/register.html', {'user_form': user_form})

def user_login(request):

if request.method == 'POST':

username =
request.POST['username']
password =
request.POST['password']
user = authenticate(request, username=username,

Department of Computer Science and Engineering,MBITS 40


Online Voting System

password=password) if user is not None:


login(request,
user) try:
voter =
Voter.objects.get(user=user)
if not voter.is_registered:
return
redirect('register_face') except
Voter.DoesNotExist:
pass

return
redirect('profile') else:
messages.error(request, 'Invalid username or
password.') return render(request, 'voting/login.html')
@login_required

def
user_logout(reques
t): logout(request)
return redirect('home')

@login_requ
ired def
profile(requ
est):
voter = get_object_or_404(Voter,
user=request.user) votes =
Vote.objects.filter(voter=voter)
return render(request, 'voting/profile.html',
{ 'voter': voter,
'votes': votes,

Department of Computer Science and Engineering,MBITS 41


Online Voting System

'is_face_registered': voter.face_encoding is not None

})

@login_required

def register_face(request):

voter = get_object_or_404(Voter, user=request.user)

if request.method ==
'POST': # Handle
base64 image data
if 'image_data' in request.POST:
img_data =
request.POST['image_data']
format, imgstr =
img_data.split(';base64,') ext =
format.split('/')[-1]
============================= Create temporary file=====================

temp_file = tempfile.NamedTemporaryFile(suffix=f'.{ext}', delete=False)


temp_file.write(base64.b64decode(imgstr))
temp_file.close()

============================== Get face encoding=======================

face_encoding = get_face_encoding(temp_file.name)

============================== Clean up temp file======================

os.unlink(temp_file.name)

if face_encoding:

Department of Computer Science and Engineering,MBITS 42


Online Voting System

voter.face_encoding =
face_encoding
voter.is_registered = True
voter.save()
messages.success(request, 'Face registered
successfully!') return redirect('profile')
else:

messages.error(request, 'No face detected. Please try again.')

============================= Handle webcam capture===================

else:

face_data =
detect_faces_webcam() if
face_data:
voter.face_encoding = face_data["encoding"]

voter.is_registered = True voter.save()


messages.success(request, 'Face registered
successfully!') return redirect('profile')
else:

messages.error(request, 'No face detected. Please try


again.') return render(request, 'voting/register_face.html')
@login_required

def elections_list(request):
current_time =
timezone.now()
active_elections = Election.objects.filter(is_active=True, end_date
gt=current_time) past_elections = Election.objects.filter(end_date
lt=current_time)

Department of Computer Science and Engineering,MBITS 43


Online Voting System

return render(request,
'voting/elections_list.html',
{ 'active_elections': active_elections,
'past_elections': past_elections
})

@login_required

def election_detail(request, election_id):

election = ge get_object_or_404(Voter,
user=request.user)

has_voted = Vote.objects.filter(voter=voter, election=election).exists()

===========================Check if election is still active=================


is_active = election.is_active and election.end_date > timezone.now()

return render(request,
'voting/election_detail.html', { 'election': election,
'has_voted':
has_voted,
'is_active':
is_active
})

@login_required

def vote(request, election_id):

election = get_object_or_404(Election,
Department of Computer Science and Engineering,MBITS 44
Online Voting System

id=election_id) voter = get_object_or_404(Voter,


user=request.user)

# Check if election is still active

if not election.is_active or election.end_date <=


timezone.now(): messages.error(request, 'This election
is no longer active.') return redirect('election_detail',
election_id=election.id)

=======================Check if user has already voted===============


if Vote.objects.filter(voter=voter, election=election).exists():
messages.error(request, 'You have already voted in this
election.') return redirect('election_detail',
election_id=election.id)

if request.method == 'POST':

candidate_id =
request.POST.get('candidate') if
candidate_id:
candidate = get_object_or_404(Candidate, id=candidate_id)
=====================Face Verification===========================

if 'verified' not in
request.session: return
redirect('verify_face')

================================Createvote===========================

Vote.objects.create(voter=voter, election=election, candidate=candidate)


messages.success(request, 'Your vote has been recorded.')

Department of Computer Science and Engineering,MBITS 45


Online Voting System

==============================Clear Verification========================

if 'verified' in
request.session: del
request.session['verifi
ed']

return redirect('election_detail', election_id=election.id)

candidates =
election.candidates.all() return
render(request, 'voting/vote.html',
{

'election':
election,
'candidates':
candidates

})

@login_required

def verify_face_view(request):

voter = get_object_or_404(Voter, user=request.user)

if not voter.face_encoding:

messages.error(request, 'You need to register your face


first.') return redirect('register_face')

Department of Computer Science and Engineering,MBITS 46


Online Voting System

if request.method == 'POST':

if 'image_data' in request.POST:

img_data =
request.POST['image_data'] format,
imgstr = img_data.split(';base64,')
ext = format.split('/')[-1]

============================Createtemporaryfile========================

temp_file = tempfile.NamedTemporaryFile(suffix=f'.{ext}', delete=False)


temp_file.write(base64.b64decode(imgstr))

temp_file.close()

=============================Verifyface===============================

is_verified = verify_face(voter.face_encoding, temp_file.name)

# Clean up temp file


os.unlink(temp_file.name)

if is_verified:
request.session['verified']
= True

messages.success(request, 'Face verification


successful!') # Get the next URL from the
query parameters

next_url = request.GET.get('next',
'elections') return redirect(next_url)

else:

messages.error(request, 'Face verification failed. Please try again.')

=================Handle webcam capture for verification=============

else:

face_data = detect_faces_webcam() if

Department of Computer Science and Engineering,MBITS 47


Online Voting System

face_data:
is_verified = verify_face(voter.face_encoding,
face_data["image_path"]) if is_verified:
request.session['verified'] = True
messages.success(request, 'Face verification
successful!')
======================== Get the next URL from the query parameters=========
next_url = request.GET.get('next', 'elections')
return
redirect(next_url)
else:
messages.error(request, 'Face verification failed. Please try again.')

else:

messages.error(request, 'No face detected. Please try


again.') return render(request, 'voting/verify_face.html')
@login_required

def results(request, election_id):

election = get_object_or_404(Election,
id=election_id) candidates =
election.candidates.all()
results = []

for candidate in candidates:

vote_count = Vote.objects.filter(election=election, candidate=candidate).count()


results.append({
'candidate':
candidate, 'votes':
vote_count
})

======================== Sort by vote count in descending order==============

Department of Computer Science and Engineering,MBITS 48


Online Voting System

results.sort(key=lambda x: x['votes'], reverse=True)

total_votes = Vote.objects.filter(election=election).count()
return render(request, 'voting/results.html',
{ 'election': election,
'results': results,
'total_votes':
total_votes
})

============================= ADMIN VIEWS =======================

@login_required

def
add_candidate(req
uest): if not
request.user.is_staf
f:
messages.error(request, 'You must be an admin to access this
page.') return redirect('home')

if request.method == 'POST':

form = CandidateForm(request.POST,
request.FILES) if form.is_valid():
candidate =
form.save(commit=False) #
Get face encoding from the
image
face_encoding =
get_face_encoding(candidate.image.path) if
face_encoding:
candidate.face_encoding = face_encoding
Department of Computer Science and Engineering,MBITS 49
Online Voting System

candidate.save()
messages.success(request, 'Candidate added
successfully!') return redirect('elections')
else:

messages.error(request, 'No face detected in the candidate image. Please try a


different
form = CandidateForm()

return render(request, 'voting/add_candidate.html', {'form': form})

@login_required

def add_election(request):

if not request.user.is_staff:

messages.error(request, 'You must be an admin to access this page.')

return redirect('home')

if request.method == 'POST':

form =
ElectionForm(request.POST)
if form.is_valid():
election = form.save()

messages.success(request, 'Election created


successfully!') return redirect('elections')
else:

form = ElectionForm()

Department of Computer Science and Engineering,MBITS 50


Online Voting System

return render(request, 'voting/add_election.html', {'form': form})

============================ CONNECTION ========================

#URL configuration for face_voting project.

from django.contrib import


admin from django.urls import
path, include from django.conf
import settings
from django.conf.urls.static import static

urlpatterns = [

path('admin/',
admin.site.urls), path('',
include('voting.urls')),
]

if settings.DEBUG:

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

#URL configuration for voting

from django.urls
import path from .
import views

Department of Computer Science and Engineering,MBITS 51


Online Voting System

urlpatterns = [

path('', views.home, name='home'),


path('register/', views.register,
name='register'),

path('login/', views.user_login, name='login'),


path('logout/', views.user_logout, name='logout'),
path('profile/', views.profile, name='profile'),
path('elections/', views.elections_list,
name='elections'),
path('election/<int:election_id>/', views.election_detail,
name='election_detail'), path('vote/<int:election_id>/', views.vote,
name='vote'), path('results/<int:election_id>/', views.results,
name='results'), path('admin/add-candidate/', views.add_candidate,
name='add_candidate'), path('admin/add-election/', views.add_election,
name='add_election'), path('verify-face/', views.verify_face_view,
name='verify_face'),
path('register-face/', views.register_face, name='register_face'),

===========================================================

Department of Computer Science and Engineering,MBITS 52


Online Voting System

CHAPTER 5
TESTING
Coding conventions are a set of guidelines for a specific programming language that
recommend Programming style, practices and methods for each aspect of a piece program
written in this language. These conventions usually cover file organization, indentation,
comments, declarations, statements, white space, naming conventions, programming
practices, programming principles, programming rules of thumb, architectural best practices,
etc. These are guidelines for software structural quality. Software programmers are highly
recommended to follow these guidelines to help improve the readability of their source
code and make software maintenance easier.

5.1 TEST CASES

The objective of system testing is to ensure that all individual programs are working as
expected, that the programs link together to meet the requirements specified and to ensure
that the computer system and the associated clerical and other procedures work together. The
initial phase of system testing is the responsibility of the analyst who determines what
conditions are to be tested, generates test data, produced a schedule of expected results, runs
the tests and compares the computer produced results with the expected results with the
expected results. The analyst may also be involved in procedures testing. When the analyst
is satisfied that the system is working properly, he hands it over to the users for testing.
The importance of system testing by the user must be stressed. Ultimately it is the user
must verify the system and give the go-ahead. During testing, the system is used
experimentally to ensure that the software does not fail, i.e., that it will run according to its
specifications and in the way users expect it to. Special test data is input for processing (test
plan) and the results are examined to locate unexpected results. A limited number of users
may also be allowed to use the system so analysts can see whether they try to use it in
unexpected ways. It is preferably to find these surprises before the organization implements
the system and depends on it. In many organizations, testing is performed by person other
than those who write the original programs. Using persons who do not know how certain
parts were designed or programmed ensures more complete and unbiased testing and more
reliable software.
Department of Computer Science and Engineering,MBITS 53
Online Voting System

Parallel running is often regarded as the final phase of system testing. Since he parallel
operation of two systems is very demanding in terms of user resources it should be embarked
on only if the user is satisfied with the results of testing -- it should not be started if problems
are known to exist. Testing is the major quality control measure during software development.
Its basic function is to detect errors in the software. Thus, the goal of testing is to uncover
requirement design and coding errors in the program. Testing is the process of correcting
a program with intends of finding an error.

Creating effective test cases involves understanding the application’s functionality, user
requirements, and potential edge cases. This process often includes writing detailed scenarios
that cove both positive and negative test conditions. Positive test cases validate that the
software can gracefully handle invalid or unexpected input. Comprehensive test cases
improve the reliability and quality of the software by systematically identifying issues that
could impact users. Test cases also facilitate communication among developers, testers, and
stakeholders by providing a clear and structured way to evaluate software performance.

Different types of testing are,

1. Unit Testing

2. Integrated Testing

3. Black Box Testing

4. White Box Testing

5. Validation Testing

6. User Acceptance Testing

5.1.1 UNIT TESTING

In computer programming, unit testing is a method by which individual units of source


code, sets of one or more computer program modules together with associated control
data, usage procedures, and operating procedures are tested to determine if they are fit for
use. In this testing we test each module individual and integrated the overall system. Unit

Department of Computer Science and Engineering,MBITS 54


Online Voting System

testing focuses verification efforts on thesmaller unit of software design in the module. This
is also known as module testing. The modules of the system are tested separately. The
testing is carried out during programming stage itself. In this testing step each module is
found to working satisfactory as regard to the expected output from the module. There are
some validation checks for verifying the data input given by the user which both the formal
and validity of the entered. It is very easy to find error debug the system.

5.1.2 INTEGRTAED TESTING

Integration testing (sometimes called integration and testing, abbreviated I&T) is the phase in
software testing in which individual software modules are combined and tested as a group.

Software components may be integrated in an iterative way or all together ("big bang").
Normally the former is considered a better practice since it allows interface issues to be
located more quickly and fixed. Data can be lost across an interface; one module can have an
adverse effort on the other sub functions when combined by, may not produce the desired
major functions. Integrated testing is the systematic testing for constructing the uncover
errors within the interface. This testing was done with sample data. The developed system
has run success full for this sample data. The need for integrated test is to find the
overall system performance. Integration testing is a logical extension of unit testing. In its
simplest form, two units that have already been tested are combined into a component and the
interface between them is tested. A component, in this sense, refers to an integrated aggregate
of more than one unit. Integration testing identifies problems that occur when units are
combined. By using a test plan that requires you to test each unit and ensure the viability
of each before combining units, you know that any errors discovered when combining units
are likely related to the interface between units. This method reduces the number of
possibilities to a far simpler level of analysis. Progressively larger groups of tested software
components corresponding to elements of the architectural design are integrated and tested
until the software works as a system.

5.1.3 BLACKBOX TESTING

Black-box testing is a method of software testing that examines the functionality of an

Department of Computer Science and Engineering,MBITS 55


Online Voting System

application (e.g., what the software does) without peering into its internal structures or
workings. This method of test can be applied to virtually every level of software testing: unit,
integration, system and acceptance.

Typically comprises most if not all higher level testing, but can also dominate unit testing
as well. In black box testing the structure of the program is not considered. Test cases are
decided solely on the basis of the requirements or the specification of the program or module,
and the internals of the module or program are not considered for selection of the test cases.
In the Black Box testing tester only knows the input that can be given to the system and what
output the system should give. In other words, the basis of deciding test cases in
functional testing is requirements or specifications of the system or module. This form of
testing is also called functional or behavioural testing. One advantage of the black box
technique is that no programming knowledge is required. Whatever biases the programmers
may have had, the tester likely has a different set and may emphasize different areas of
functionality. On the other hand, black-box testing has been said to be "like a walk in a
dark labyrinth without a flashlight. Because they do not examine the source code, there
are situations when a tester writes many test cases to check something that could have
been tested by only one test case, or leaves some

5.1.4 WHITEBOX TESTING

White-box testing (also known as clear box testing, glass box testing, and transparent
box testing and structural testing) is a method of testing software that tests internal
structures or workings of an application, as opposed to its functionality. In white-box testing
an internal perspective of the system, as well as programming skills, are used to design test
cases. The tester chooses inputs to exercise paths through the code and determine the
appropriate outputs. This is analogous to testing nodes in a circuit, e.g. in- circuit testing
(ICT).

While white-box testing can be applied at the unit, integration and system levels of the
software testing process, it is usually done at the unit level. It can test paths within a unit,

Department of Computer Science and Engineering,MBITS 56


Online Voting System

paths between units during integration, and between subsystems during a system–level
test. Though this method of test design can uncover many errors or problems, it might not
detect unimplemented parts of the specification or missing requirements. White Box testing is
concerned with testing the implementation of the program. The intent of this testing is not to
exercise all the different input or output conditions but to exercise the different
programming structures and data structures used in the program.

White-box test design techniques include:

• Control flow testing

• Data flow testing

• Branch testing

• Path testing

• Statement coverage

5.1.5 VALIDATION TESTING

At the culmination of Black Box testing, software is completely assembled as a package,


interface errors have been uncovered and corrected and final series of software tests,
Validation tests begins. Validation testing can be defined many was but a simple
definition is that validation succeeds when the software functions in a manner that can be
reasonably accepted by the customer. After validation test has been conducted one of the two
possible conditions exists.
1. The function or performance characteristics confirm to specification and are accepted.

2. A derivation from specification uncovered and a deficiency list is created.

5.1.6 USER ACCEPTANCE TESTNG

Acceptance Testing is a level of the software testing process where a system is tested for
acceptability. User Acceptance testing is the software testing process where system tested for
acceptability & validates the end to end business flow. Such type of testing executed by client

Department of Computer Science and Engineering,MBITS 57


Online Voting System

in separate environment & confirms whether system meets the requirements as per
requirement specification or not.

UAT is performed after System Testing is done and all or most of the major defects have
been fixed. This testing is to be conducted in the final stage of Software Development
Life Cycle (SDLC) prior to system being delivered to a live environment. UAT users or end
users are concentrating on end to end scenarios & typically involves running a suite of
tests on the completed system.

User Acceptance testing also known as Customer Acceptance testing (CAT), if the system is
being built or developed by an external supplier. The CAT or UAT are the final confirmation
from the client before the system is ready for production. The business customers are the
primary owners of these UAT tests. These tests are created by business customers and
articulated in business domain languages. So ideally it is collaboration between business
customers, business analysts, testers and developers. It consists of test suites which involve
multiple test cases & each test case contains input data (if required) as well as the
expected output. The result of test case is either a pass or fail.

5.2 TEST CASE DOCUMENTS

TC Test Steps Expected Result Actual Result Status Comment

No
.
1 Run website and Login screen is Login screen has been Pass
navigate to login displayed. A field for displayed. fields for
screen entering username, entering username,
password and login password, and login
button
button should be is available
present

Department of Computer Science and Engineering,MBITS 58


Online Voting System

2 Enter an invalid A message should A message has been Pass


username and be displayed stating displayed stating
invalid that username and
password. the username password
and password is are invalid.
invalid.
3 Enter a valid User must A message has been Pass Using
user name and successfully log displayed stating login admin
password and into the webpages. successful and as the
press the button. navigate into home usernam
page e
and
passwor
d.
4 Enter a valid A message should be A message has been Pass

username and displayed stating that displayed stating that


leave please enter the please enter the
password press username and username and password
the button password
5 Leave username A message should be A message has been Pass
and password and displayed stating that displayed stating that
press the button please enter the please enter the
username and username and
password password
6 Leave username A message should A message has been Pass
and enter a valid be displayed stating displayed stating that
password and that please enter the please enter the
press the button username and username and
password password

Department of Computer Science and Engineering,MBITS 59


Online Voting System

CHAPTER 6
CONCLUSION

OVS- Online Voting System is the integration of face recognition technology into
an online voting system for college student elections represents a significant
advancement in ensuring secure, efficient, and trustworthy electoral processes. This
innovative approach not only simplifies the voting experience but also strengthens voter
authentication, effectively eliminating the risks of identity fraud and impersonation. By
leveraging biometric verification, the system guarantees that only eligible students can
cast their votes, thereby enhancing the integrity of the election.

The use of face recognition also streamlines the authentication process, reducing wait
times and minimizing the need for manual verification, which can often be prone to
errors. Additionally, the system’s ability to process votes in real-time promotes
transparency and quick result tabulation, fostering greater confidence among students in
the electoral process. As colleges continue to embrace digital transformation, the adoption
of an online voting system powered by face recognition technology stands as a progressive
step toward modern, secure, and user-friendly elections. Ultimately, this system not only
simplifies the voting process but also empowers students to actively participate in shaping
their academic communities with confidence and ease.

6.1. FUTURE ENHANCEMENTS

As technology evolves, the online voting system with face recognition can be further
enhanced to ensure higher security, greater accessibility, and increased trust in the electoral
process. One of the most significant future improvements would be the implementation
of multi-factor authentication (MFA). While face recognition provides a robust form of
identity verification, adding additional layers, such as One-Time Password (OTP) sent via
email or SMS, would provide an extra level of security, ensuring that only eligible
students can vote while minimizing the risks of identity theft or unauthorized access.
Department of Computer Science and Engineering,MBITS 60
Online Voting System

Additionally, the facial recognition algorithm can be continuously refined to improve


accuracy, particularly under different lighting conditions, angles, or if a student’s facial
features change over time. Enhancing the algorithm to handle such variables with a higher
degree of precision will minimize the chances of false positives and negatives, ensuring a
smoother voting experience for students. This improvement can also help to accommodate a
wider range of students, from those with different skin tones to those with facial hair or
glasses.

In the realm of data integrity and security, this technologycould be incorporated into the
system to create a transparent and tamper-proof ledger of votes. By using blockchain, the
election process could be made even more secure, as every vote would be encrypted and
stored in a decentralized ledger. This would provide an immutable record that could be
independently verified, further assuring students of the credibility of election results and
reducing the risk of tampering.

To make the system even more accessible, future enhancements could include the
development of a mobile application that allows students to vote securely from their
smartphones. Given the widespread use of mobile devices, this feature would significantly
improve convenience, enabling students to participate in elections no matter where they are.
The app could also be optimized for a more seamless and intuitive user experience, with a
design that is simple and easy to navigate, particularly for first-time voters.

Accessibility and inclusivity will also be major considerations. The goal is to create systems
that are effective across diverse demographics, including different skin tones, facial structures,
and individuals with disabilities. To maximize voter participation, systems will be optimized
for use on smartphones and in low-bandwidth environments, making online voting more
accessible to a broader audience.

To ensure transparency and fairness, the future of online voting will incorporate real-time
monitoring and auditability features. AI-driven algorithms will be employed to detect
suspicious activities and unusual voting patterns as they occur. Moreover, systems will

Department of Computer Science and Engineering,MBITS 61


Online Voting System

maintain comprehensive audit trails, allowing independent verification of the voting


process without compromising voter anonymity, thus increasing public confidence in the
electoral system.

Department of Computer Science and Engineering,MBITS 62


Online Voting System

CHAPTER 7
REFERENCES

1. Vijay Laxmi Vashisht,Harsh Mohan,S.Prakash “SMART VOTING SYSTEM


THROUGH FACE RECOGNITION”, International Conference on Advances in
Computing,Communication Control and Networking(ICAC3N),Volume 4,Issue 9, pp.
1686 – 1688, 2017

https://ieeexplore.ieee.org/document/10073982

2. Vaisali .V. Sarkate ,Prof. R.S.Guptha, Prof.Y.S.Alone "Smart voting system support
through face recognition", International Journal of Emerging Technologies and
Innovative Research (www.jetir.org | UGC and issn Approved), ISSN:2349-5162,
Vol.6, Issue 5, page no. pp281-283, May-2019

http://www.jetir.org/papers/JETIR1905P43.pdf

3. Chandra Keerthi Pothina , Atla Indu Reddy, Ravikumar CV, "Smart Voting
System using Facial Detection” , International Journal of Innovative Technology
and Exploring Engineering (IJITEE)
ISSN: 2278-3075 (Online), Volume-9 Issue-6, April 2020

https://www.researchgate.net/publication/363856363

Department of Computer Science and Engineering,MBITS 63


Online Voting System

CHAPTER 8

APPENDIX

8.1. Screen Shots

Department of Computer Science and Engineering,MBITS 64


Online Voting System

Department of Computer Science and Engineering,MBITS 65


Online Voting System

Department of Computer Science and Engineering,MBITS 66


Online Voting System

Department of Computer Science and Engineering,MBITS 67


Online Voting System

Department of Computer Science and Engineering,MBITS 68


Online Voting System

Department of Computer Science and Engineering,MBITS 69


Online Voting System

Department of Computer Science and Engineering,MBITS 70


Online Voting System

Department of Computer Science and Engineering,MBITS 71


Online Voting System

Department of Computer Science and Engineering,MBITS 72


Department of Computer Science and Engineering,MBITS 73

You might also like