0% found this document useful (0 votes)
3 views

Imagecompression

Uploaded by

Kalluri Sahasra
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Imagecompression

Uploaded by

Kalluri Sahasra
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

5Using Existing CCtv Network for Crowd Management,

Crime Prevention & Work Monitoring Using AI&ML


INNOVATIVE PRODUCT DEVELOPMENT REPORT

Submitted by

G. Sushmitha K. Niharika K. Sravanthi


22RH1A6668 22RH1A6686 22RH1A66A2

Under the Esteemed Guidance of


Mr. Shaik Mohammed Imran

Assistant Professor
in partial fulfillment of the Academic Requirements for the Degree of

BACHELOR OF TECHNOLOGY

CSE-AI & ML

MALLA REDDY ENGINEERING COLLEGE FOR WOMEN


Autonomous Institution, UGC, Govt. of India
Accredited by NAAC with A+ Grade
Affiliated to JNTUH, Approved by AICTE, ISO 9001:2015 Certified Institute
Maisammaguda (V), Dhullapally (Post), (Via) Kompally, Medchal Malkajgiri Dist. T.S-500100

JUNE- 2024
MALLA REDDY ENGINEERING COLLEGE FOR
WOMEN
Autonomous Institution, UGC, Govt. of India
Accredited by NAAC with A+ Grade
Affiliated to JNTUH, Approved by AICTE, ISO 9001:2015 Certified Institute
Maisammaguda (V), Dhullapally (Post), (Via) Kompally, Medchal Malkajgiri Dist. T.S-500100

DEPARTMENT OF CSE - AI &ML

CERTIFICATE

This is to certify that the Innovative Product Development work entitled Using Existing
CCtv Network for Crowd Management, Crime Prevention & Work Monitoring Using
AI & ML
iscarried out by
G.Sushmitha(22RH1A6668),K.Mouinka(22RH1A6680),K.Sahasra(22RH1A6682),
K.Akshara(22RH1A66A4) in partial fulfillment for the award of degree of BACHELOR OF
TECHNOLOGY in CSE - AI & ML, Jawaharlal Nehru Technological University, Hyderabad
during the academic year 2023-2024.

Supervisor’s Signature Head of the Department


Mr. Shaik Mohammed Imran Dr. G. Kalpana
Asst. Professor

External Examiner
MALLA REDDY ENGINEERING COLLEGE FOR WOMEN
Autonomous Institution, UGC, Govt. of India
Accredited by NAAC with A+ Grade
Affiliated to JNTUH, Approved by AICTE, ISO 9001:2015 Certified Institute
Maisammaguda (V), Dhullapally (Post), (Via) Kompally, Medchal Malkajgiri Dist. T.S-
500100

Department of CSE –AI &ML

DECLARATION

We hereby declare that the Innovative Product Development entitled Using


Existing CCtv Network for Crowd Management, Crime prevention & Work Monitoring
using AI & ML submitted to Malla Reddy Engineering College For Women affiliated to Jawaharlal
Nehru Technological University, Hyderabad (JNTUH) for the award of the Degree of Bachelor of
Technology in CSE-AI & ML is a result of original research work done by us. It is further declared that
the Innovative Product Development report or any part thereof has not been previously submitted to
any University or Institute for the award of Degree.

G.Sushmitha (22RH1A6668)

K.Niharika (22RH1A6686)

K.Sravanthi

(22RH1A66A2)
ACKNOWLEDGEMENT

We feel ourselves honored and privileged to place our warm salutation to our
college Malla Reddy Engineering College for Women and Department of CSE-
AI&ML which gave us the opportunity to have expertise in engineering and profound
technical knowledge.

We would like to deeply thank our Honorable MLA of Telangana State Sri.Ch.
Malla Reddy Garu, founder chairman MRGI, the largest cluster of institutions in the
state of Telangana for providing us with all the resources in the college to make our
project success.
We wish to convey gratitude to our Principal Dr. Y. Madhavee Latha, for
providing us with the environment and mean to enrich our skills and motivating us in our
endeavor and helping us to realize our full potential.

We would like to thank Prof. A. Radha Rani, Director of Computer Science and
Engineering & Information Technology for encouraging us to take up a project on this
subject and motivating us towards the Project Work.
We express our sincere gratitude to Dr. G. Kalpana, Head of the Department of
CSE–AI&ML for inspiring us to take up a project on this subject and successfully guiding
us towards its completion.

We would like to thank our guide Mr. Shaik Mohammed Imran, Asst. Professor
of CSE-AI&ML Dept and all the Faculty members for their valuable guidance and
encouragement towards the completion of our project work.

With Regards and Gratitude

G. Sushmitha(22RH1A6668)

K. Mounika (22RH1A6680)

K. Sahasra (22RH1A6682)

K. Akshara (22RH1A66A4)
ABSTRACT
INDEX

TITLE i
CERTIFICATE ii
DECLARATION iii
ACKNOWLEDGMENT iv
ABSTRACT v

1. INTRODUCTION 1
1.1 Project Definition 1
1.2 Project Overview 1

1.4 Hardware Requirements 2


2. LITERATURE SURVEY 2
2.1 Existing System 3
2.2 Disadvantages 3

2.4 Advantages 3
3. METHODOLOGY 4
4 SYSTEM ARCHITECTURE 6
5. IMPLEMENTATION 12
6. RESULTS 19
7. CONCLUSION & FUTURE SCOPE 21
REFERENCES 23
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

CHAPTER 1
INTRODUCTION
PROJECT DEFINITION
Image compression is an application of data compression that encodes the original image with
few bits. The objective of image compression is to reduce irrelevance and redundancy of the
image data in order to be able to store or transmit data in an efficient form. Image compression
means the reduction of the size of image data, while retraining necessary information.
Mathematically this means transforming a 2D pixel array into a statically uncorrelated data set.
Two fundamental components of compression are redundancy and irrelevancy reduction.
Redundancies reduction aims at removing duplication from the signal source (image/video).
Irrelevancy reduction omits parts of the signal that will not be noticed by the signal receiver,
namely the Human Visual System.

PROJECT OVERVIEW

In Lossless image compression no data loss when the compression Technique is done. In this
research, a new lossless compression scheme is presented and named as Huffman Based LZW
Lossless Image Compression using Retinex Algorithm which consists of three stages: In the
first stage, a Huffman coding is used to compress the image. In the second stage all Huffman
code words are concatenated together and then compressed with LZW coding and decoding. In
the third stage the Retinex algorithm are used on compressed image for enhance the contrast of
image and improve the quality of image. This Proposed Technique is used to increase the
compression ratio (CR), Peak signal of Noise Ratio (PSNR), and Mean Square Error (MSE) in
the MATLAB Software.

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

1
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

SOFTWARE REQUIREMENTS:
 Operating System - Windows10(min)
 Programming Language - Python

HARDWARE REQUIREMENTS
 Processor - Intel i3(min)

 Speed - 1.1 GHz


 RAM - 4GB(min)
 Hard Disk - 500 GB

Advantages:
 High Accuracy
 Takes less time

Disadvantages:
 Less Accuracy
 More time taking process

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

2
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

CHAPTER 2
LITERATURE SURVEY
Existing System:

For web designers who wish to develop websites that load more quickly and are more
accessible to users, image compression is essential. By offering good quality images at a
quarter of the file size, picture compression also saves a significant amount of needless
bandwidth. For individuals who attach photographs to emails, image compression is especially
crucial since it may expedite email delivery and save bandwidth expenses. Image compression
is especially crucial for digital camera users and those who save a large number of photographs
on their hard drives since it allows us to store more images on our hard drives and conserve
memory. An outstanding illustration of the signifiYBhlo jcance of data compression is images
sent over the internet. Assume we have a digital colour picture that has to be downloaded across
a 33.6 kbps modem on a PC. The picture will have around 600 kilo bytes of data if it is not
compressed (a TIFF file, for instance).

Proposed System:

This study suggests a way for compressing images utilising the two lossless approaches of
Lempel Ziv Welch coding and Huffman coding. The first step is compressing the picture using
Huffman coding, which yields the Huffman tree and Huffman Code words. Using Lempel Ziv
Welch coding, all Huffman code words are concatenated and compressed in the second step.
The Retinex algorithm is used to a compressed picture in the third step to boost contrast and
improve image quality.

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

3
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

CHAPTER 3
METHODOLOGY

NON-FUNCTIONAL REQUIREMENT:
Usability: Usability is a quality attribute that assesses how easy user interfaces are to use. The
word "usability" also refers to methods for improving ease-of-use during the design process.
(how it was handle entire project easy)
Security:the quality or state of being secure: such as. a : freedom from danger : safety. b :
freedom from fear or anxiety. c : freedom from the prospect of being laid off job security.
Readability: Readability is the ease with which a reader can understand a written text.
Performance: the execution of an action. : something accomplished : deed, feat. :
thefulfillment of a claim, promise, or request : implementation. 3. : the action of representing a
character in a play.
Availability: the quality or state of being available trying to improve the availability of
affordable housing. 2 : an available person or thing.
Scalability: Scalability is the measure of a system's ability to increase or decrease in
performance and cost in response to changes in application and system processing demand.
The outputs of the requirements definition stage include the requirements document, the RTM,
and an updated project plan.

 Feasibility study is all about identification of problems in a project.

 No. of staff required to handle a project is represented as Team Formation, in this case
only modules are individual tasks will be assigned to employees who are working for
that project.

 Project Specifications are all about representing of various possible inputs submitting to
the server and corresponding outputs along with reports maintained by administrato

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

4
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

Analysis Stage:

The planning stage establishes a bird's eye view of the intended software product, and uses this
to establish the basic project structure, evaluate feasibility and risks associated with the project,
and describe appropriate management and technical approaches.

Figure : 3.1

The most critical section of the project plan is a listing of high-level product requirements, also
referred to as goals. All of the software product requirements to be developed during the
requirements definition stage flow from one or more of these goals. The minimum information
for each goal consists of a title and textual description, although additional information and
references to external documents may be included. The outputs of the project planning stage are
the configuration management plan, the quality assurance plan, and the project plan and
schedule, with a detailed listing of scheduled activities for the upcoming Requirements stage,
and high level estimates of effort for the out stages.

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

5
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

Integration & Test Stage:

During the integration and test stage, the software artifacts, online help, and test data are
migrated from the development environment to a separate test environment. At this point, all
test cases are run to verify the correctness and completeness of the software. Successful
execution of the test suite confirms a robust and complete migration capability. During this
stage, reference data is finalized for production use and production users are identified and
linked to their appropriate roles. The final reference data (or links to reference data source files)
and production user list are compiled into the Production Initiation Plan.

figure : 3.2

The outputs of the integration and test stage include an integrated set of software, an online help
system, an implementation map, a production initiation plan that describes reference data and
production users, an acceptance plan which contains the final suite of test cases, and an updated
project plan.

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

6
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

CHAPTER 4
SYSTEM ARCHITECTURE

COMPONENT DIAGRAM:
In the Unified Modelling Language, a component diagram depicts how components are
wired together to form larger components and or software systems. They are used to illustrate
the structure of arbitrarily complex systems.
Components are wired together by using an assembly connector to connect the required
interface of one component with the provided interface of another component. This illustrates
the service consumer - service provider relationship between the two components.

def upload
Text():

def compress
DecompressText():

def upload
Image():

USER
def compres
sImage():

def graph():

def close():

figure : 4.1

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

7
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

DEPLOYMENT DIAGRAM:

A deployment diagram in the Unified Modeling Language models the physical


deployment of artifacts on nodes. To describe a web site, for example, a deployment diagram
would show what hardware components ("nodes") exist (e.g., a web server, an application
server, and a database server), what software components ("artifacts") run on each node (e.g.,
web application, database), and how the different pieces are connected (e.g. JDBC, REST,
RMI).

The nodes appear as boxes, and the artifacts allocated to each node appear as rectangles
within the boxes. Nodes may have sub nodes, which appear as nested boxes. A single node in a
deployment diagram may conceptually represent multiple physical nodes, such as a cluster of
database servers.

def upload
Text():

def compress
Decompress

def upload
Image():
USER

def compress
Image():

def
graph():
def
close():

figure : 4.2
MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

8
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

ACTIVITY DIAGRAM:

Activity diagram is another important diagram in UML to describe dynamic aspects of


the system. It is basically a flow chart to represent the flow form one activity to another
activity. The activity can be described as an operation of the system. So the control flow is
drawn from one operation to another. This flow can be sequential, branched or concurrent.

def uploadText():

def compressDecompressText():

def uploadImage():
def uploadImage():

def compressImage():

def graph():

def Close():

figure : 4.3

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

9
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

Data flow :

Data flow diagrams illustrate how data is processed by a system in terms of inputs and outputs.
Data flow diagrams can be used to provide a clear representation of any business function. The
technique starts with an overall picture of the business and continues by analyzing each of the
functional areas of interest. This analysis can be carried out in precisely the level of detail
required. The technique exploits a method called top-down expansion to conduct the analysis
in a targeted way.

As the name suggests, Data Flow Diagram (DFD) is an illustration that explicates the passage
of information in a process. A DFD can be easily drawn using simple symbols. Additionally,
complicated processes can be easily automated by creating DFDs using easy-to-use, free
downloadable diagramming tools. A DFD is a model for constructing and analyzing
information processes. DFD illustrates the flow of information in a process depending upon the
inputs and outputs. A DFD can also be referred to as a Process Model. A DFD demonstrates
business or technical process with the support of the outside data saved, plus the data flowing
from the process to another and the end results.

User
1. Upload Text 2. Successfully Upload Text
3. Compress Decompress Text 4. Successfully Compress Decompress Text
5. Upload Image 6. Successfully Upload Image
7. Compress Image 8. Successfully Compress Image
9. Graph 10. Successfully Graph Plotted
11. Close Application 12. Successfully Close Application

System

figure : 4.4

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

10
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

• ECONOMIC FEASIBILITY

A system can be developed technically and that will be used if installed must still be a good
investment for the organization. In the economical feasibility, the development cost in creating
the system is evaluated against the ultimate benefit derived from the new systems. Financial
benefits must equal or exceed the costs. The system is economically feasible. It does not require
any addition hardware or software. Since the interface for this system is developed using the
existing resources and technologies available at NIC, There is nominal expenditure and
economical feasibility for certain.

 OPERATIONAL FEASIBILITY

Proposed projects are beneficial only if they can be turned out into information system. That
will meet the organization’s operating requirements. Operational feasibility aspects of the
project are to be taken as an important part of the project implementation. This system is
targeted to be in accordance with the above-mentioned issues. Beforehand, the management
issues and user requirements have been taken into consideration. So there is no question of
resistance from the users that can undermine the possible application benefits. The well-planned
design would ensure the optimal utilization of the computer resources and would help in the
improvement of performance status.

• TECHNICAL FEASIBILITY

Earlier no system existed to cater to the needs of ‘Secure Infrastructure Implementation


System’. The current system developed is technically feasible. It is a web based user interface
for audit workflow at NIC-CSD. Thus it provides an easy access to .the users. The database’s
purpose is to create, establish and maintain a workflow among various entities in order to
facilitate all concerned users in their various capacities or roles. Permission to the users would
be granted based on the roles specified. Therefore, it provides the technical guarantee of
accuracy, reliability and security.

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

11
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

CHAPTER 5
IMPLEMENTATION

5.1 Libraries
 NumPy:

The NumPy Python library for multi-dimensional, big-scale matrices adds a huge number of
high-level mathematical functions. It is possible to modify NumPy by utilizing a Python library.
Along with line, algebra, and the Fourier transform operations, it also contains several matrices-
related functions.
 Matplotlib:

It is a multi-platform, array-based data visualization framework built to interact with the whole
SciPy stack. MATLAB is proposed as an open-source alternative. Matplotlib is a Python
extension and a cross-platform toolkit for graphical plotting and visualization.
 Scikit-learn:

The most stable and practical machine learning library for Python is scikit-learn. Regression,
dimensionality reduction, classification, and clustering are just a few of the helpful tools it
provides through the Python interface for statistical modeling and machine learning. It is an
essential part of the Python machine learning toolbox used by JP Morgan. It is frequently used
in various machine learning applications, including classification and predictive analysis.
 Keras:

* Google's Keras is a cutting-edge deep learning API for creating neural networks. It is created
in Python and is designed to simplify the development of neural networks. Additionally, it
enables the use of various neural networks for computation. Deep learning models are
developed and tested using the free and open-source Python software known as Keras.
Keras is a high-level deep learning library for Python. It is designed to provide a user-friendly
and intuitive interface for building and training deep learning models. Keras acts as a front-end
API, allowing developers to define and configure neural networks while leveraging the
computational backend engines, such as Tensor Flow or Theano.

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

12
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

 h5py:

* The h5py Python module offers an interface for the binary HDF5 data format. Thanks to
p5py, the top can quickly halt the vast amount of numerical data and alter it using the NumPy
library. It employs common syntax for Python, NumPy, and dictionary arrays.
 Tensor flow

TensorFlow is a Python library for fast numerical computing created and released by
Google. It is a foundation library that can be used to create Deep Learning models directly or
by using wrapper libraries that simplify the process built on top of TensorFlow. TensorFlow is
an end-to-end open source platform for machine learning. TensorFlow is a rich system for
managing all aspects of a machine learning system; however, this class focuses on using a
particular TensorFlow API to develop and train machine learning models.
 Tkinter

Tkinter is an acronym for "Tk interface". Tk was developed as a GUI extension for the
Tcl scripting language by John Ousterhout. The first release was in 1991. Tkinter is the de
facto way in Python to create Graphical User interfaces (GUIs) and is included in all
standard Python Distributions. In fact, it's the only framework built into the Python standard
library.
 Scipy

SciPy is a collection of mathematical algorithms and convenience functions built on the


NumPy extension of Python. It adds significant power to the interactive Python session by
providing the user with high-level commands and classes for manipulating and visualizing data.
 NLTK

NLTK is a toolkit build for working with NLP in Python. It provides us various text processing
libraries with a lot of test datasets. A variety of tasks can be performed using NLTK such as
tokenizing, parse tree visualization, etc NLTK (Natural Language Toolkit) is the go-to API for
NLP (Natural Language Processing) with Python. It is a really powerful tool to pre-process text
data for further analysis like with ML models for instance. It helps convert text into numbers,
which the model can then easily work with.

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

13
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

SOURCE CODE
Main.py

from matplotlib import pyplot as plt

from tkinter import *

from tkinter import simpledialog

from tkinter.filedialog import askopenfilename

import tkinter

from tkinter import filedialog

from HuffmanDataLZW import HuffmanLZWCoding

import os

import LZWImageCompression

from LZWImageCompression import *

import cv2

root = tkinter.Tk()

root.title("Huffman Based LZW Lossless Image Compression Using Retinex Algorithm")

root.geometry("1000x500")

global filename

global normal

global compressdef uploadText():

global filename

filename = askopenfilename(initialdir = "TextFiles")

trainpath.config(text=filename+' loaded')
MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

14
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

def compressDecompressText():

global normal

global compress

h = HuffmanLZWCoding(filename)

output_path = h.compressHuffman()

h.decompressHuffman(output_path)

normal = os.stat(filename).st_size

compress = os.stat(output_path).st_size

trainpath.config(text=filename+' original size : '+str(normal)+' & its compress size :


'+str(compress))

def uploadImage():

global filename

filename = askopenfilename(initialdir = "ImageFiles")

trainpath.config(text=filename+' loaded')

def compressImage():

global normal

global compress

LZWImageCompression.huffmanImageCompression(filename)

normal = os.stat(filename).st_size

compress = os.stat('compress/Compress.jpg').st_size

original_image = cv2.imread(filename)

original_image = cv2.resize(original_image,(500,500))

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

15
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

compress_image = cv2.imread('compress/Compress.jpg')

compress_image = cv2.resize(compress_image,(500,500))

retinex_compress_image = cv2.imread('compress/retinex_Compress.jpg')

retinex_compress_image = cv2.resize(retinex_compress_image,(500,500))

cv2.imshow("Original Image & its Size : "+str(normal),original_image);

cv2.imshow("Compress Image & its Size : "+str(compress),compress_image);

cv2.imshow("Retinex Compress Image & its Size :


"+str(compress),retinex_compress_image);

cv2.waitKey();

def graph():

height = [normal,compress]

bars = ('Normal File Size','Compress File Size')

y_pos = numpy.arange(len(bars))

plt.bar(y_pos, height)

plt.xticks(y_pos, bars)

plt.show()

def close():

root.destroy()

ttt = Label(root)

ttt.grid(row=0)

ttt1 = Label(root)

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA
ttt1.grid(row=3)
16
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

font = ('times', 14, 'bold')

uploadTextButton = Button(root, text="Upload Text File", command=uploadText)

uploadTextButton.grid(row=0)

uploadTextButton.config(font=font)

trainpath = Label(root)

trainpath.grid(row=6)

trainpath.config(font=font)

textButton = Button(root, text="Compress & Decompress Text File",


command=compressDecompressText)

textButton.grid(row=9)

textButton.config(font=font)

tt = Label(root)

tt.grid(row=12)

uploadimageButton = Button(root, text="Upload Image", command=uploadImage)

print(outputPath)

def textDecode(self, encodedText):

currentCode = ""

decodedText = ""

for bits in encodedText:

currentCode += bits

if(currentCode in self.reverse_mapping_arr):

characters = self.reverse_mapping_arr[currentCode]

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

17
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

decodedText += characters

currentCode = ""

return decodedText

def decompressHuffman(self, inputPath):

inputfile, file_extension = os.path.splitext(self.filepath)

outputPath = "compress/decompress.txt"

with open(inputPath, 'rb') as file, open(outputPath, 'w') as output:

bitStrings = ""

bytes = file.read(1)

while(len(bytes) > 0):

bytes = ord(bytes)

bit = bin(bytes)[2:].rjust(8, '0')

bitStrings += bit

bytes = file.read(1)

encodedText = self.removePadding(bitStrings)

decompressedText = self.textDecode(encodedText)

output.write(decompressedText)

print("Decompression Process Completed")

return outputPath

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

18
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

CHAPTER 6
OUTPUT RESULTS
Interface:

figure : 6.1
Image after Compression and Retinex :

figure : 6.2

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

19
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

figure : 6.3
In above screen original images.jpg file size is 10KB and now see compress file
size in compress folder.
In above screen compress.jpg file size is 5.33 KB and we can see Retinex applied
image also along with compress image

Bar Graph:

figure : 6.4

In above graph x-axis represents normal and compress image and y-axis
represents its size. Above graph clearly shows after applying compression we can
reduce image size memory.

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

20
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

CHAPTER 7
CONCLUSION AND FUTURE SCOPE

Compression is a topic of much importance and many applications. This thesis presents the
lossless image compression on different images. Different algorithms have been evaluated in
terms of the amount of compression they provide, algorithm efficiency, and susceptibility to
error. While algorithm efficiency and susceptibility to error are relatively independent of the
characteristics of the source ensemble, the amount of compression achieved depends upon
the characteristics of the source to a great extent. It is concluded that the higher data
redundancy helps to achieve more compression. Reproduced image and the original image
are equal in quality by using Retinex Algorithm, as it enhances the image contrast using
MSR

Future Scope

The promising results of this study open several avenues for future research and development:

1. Algorithm Optimization: Further optimization of the Retinex algorithm could enhance


preprocessing efficiency, leading to even better compression ratios and faster processing
times.
2. Hardware Implementation: Developing hardware-accelerated versions of the
proposed method could make it feasible for real-time applications, such as live video
streaming or on-the-fly image compression in mobile devices.
3. Extension to Other Modalities: Investigating the applicability of the proposed method
to other types of data, such as video sequences or 3D images, could broaden its utility.
4. Adaptive Techniques: Incorporating adaptive methods that adjust the parameters of the
Retinex preprocessing and compression algorithms based on image content could
further improve performance.
5. Hybrid Approaches: Exploring the integration of other compression techniques, such
as wavelet transforms or neural network-based methods, with the current approach may
yield additional improvements in compression efficiency and quality.
6. Evaluation on Diverse Datasets: Testing the method on a wider range of datasets,
including different image categories and qualities, will provide a more comprehensive
assessment of its effectiveness and robustness.

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

21
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

REFERENCES

[1] Vartika Singh “A Brief Introduction on Image Compression Techniques and


Standards” International Journal of Technology and Research Advances Volume of 2013
issue II.

[2] MamtaSharmap “Compression Using Huffman Coding” IJCSNS International Journal


of Computer Science and Network Security, VOL.10 No.5, May 2010.

[3] Sindhu M, RajkamalR“Images and Its Compression Techniques A


Review”International Journal of Recent Trends in Engineering, Vol 2, No. 4, November
2009.

[4] C.Saravanan,R. Ponalagusamy “Lossless Grey-scale Image Compression using Source


Symbols Reduction and Huffman Coding”.

[5] MayurNandihalli,VishwanathBaligar “lossless gray scale images using dynamic array


for predction and applied to higher bitplan” International Journal of Scientific and
Research Publications, Volume 3, Issue 1, January 2013.

[6] R.S.Aarthi, D. Muralidharan, P. Swaminathan “DOUBLE COMPRESSION OF TEST


DATA USING HUFFMAN CODE ” Journal of Theoretical and Applied Information
Technology15 May 2012.

[7] A. Alarabeyyat, S. Al-Hashemi1, T. Khdour1, M. Hjouj Btoush1, S. Bani-Ahmad1, R.


Al-Hashemi “Lossless Image Compression Technique Using Combination Methods
”Journal of Software Engineering and Applications, 2012.

[8] Md. Rubaiyat Hasan “Data Compression using Huffman based LZW Encoding
Technique” International Journal of Scientific & Engineering Research, Volume 2, Issue
11, November-2011. [9] Monika and Pragati Kapoor “A Huffman based LZW Approach to
Perform Image Compression” 2007.

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

22
Huffman Based LZW Image Compression Using Retinex Algorithm DEPT. OF CSE-AIML

[10] A.Mallaiah, S. K. Shabbir, T. Subhashini“ AnSpiht Algorithm With Huffman Encoder


For Image Compression And Quality Improvement Using Retinex Algorithm “
International Journal Of Scientific & Technology Research Volume 1, Issue 5, June 2012.

[11] C. Saravanan, M. Surender “Enhancing Efficiency of Huffman Coding using Lempel Ziv Coding
for Image Compression”International Journal of Soft Computing and Engineering (IJSCE) January
2013.

[12]Mr.D.V.Patil, Mr.S.G.SutarMrs.A.N.Mulla.. “Automatic Image Enhancement for Better


Visualization using Retinex Technique” International Journal of Scientific and Research
Publications, Volume 3, Issue 6, June 2013.

[13]Jiang Xing-fanga,b) , Tao Chun-kanb).” Advanced Multi Scale Retinex Algorithm for
Color Image Enhancement”International Symposium on Photoelectronic Detection and
Imaging 2007.

[14] Zia-ur Rahman a,1, Daniel J. Jobson b,, Glenn A. Woodell Investigating the relationship
between image enhancement and image compression in the context of the multi-scale Retinex
b J. Vis. Commun. Image R. 22 (2011) 237–250 science direct.

[15] AsadollahShahbahrami, RaminBahrampour, MobinSabbaghiRostami, Mostafa


AyoubiMobarhan,“Evaluation of Huffman and Arithmetic Algorithms for Multimedia
Compression Standards”

MALLAREDDY ENGINEERING COLLEGE FOR WOMEN, AUTONOMOUS INSTITUTION, UGC, GOVT OF INDIA

23

You might also like