How can i compress the text file using huffman encoding?

Hi
I am using a text file to hide inside an image file in lsb plane. But i want to compress the text file using huffman encoding and hide inside the lsb plane of image file. After retrieve the text file, the text file should be decompressed using huffman encoding.
Can you help in this matter.

1 Kommentar

Hi I took steganography as my project using lsb and lsb+huffman coding can anyone help me with correct matlab codes for encoding and decoding and mail me @prakruthi.1110@gmail.com

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Massimo Zanetti
Massimo Zanetti am 27 Sep. 2016

4 Stimmen

2 Kommentare

Thank u for ur immediate reply
Thanks a lot
If it helped you, please accept this answer.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (3)

Walter Roberson
Walter Roberson am 27 Sep. 2016
Bearbeitet: Walter Roberson am 27 Sep. 2016

2 Stimmen

9 Kommentare

Thank u for ur response.
The link which is provided by u, already i have the huffman code file. But i can't understand. So could you give me some another link so that it is easier to me to solve the problem.
Thanks a lot.
Not without a more specific question, No.
You would never hide data into the compressed data: if you did that then you might not be able to uncompress it. You would hide the data before you compressed, and then you compress.
There are over 200 posts on steganography, many of them with code.
Hi
My question is to compress large size of text file and hide inside an image using lsb technique.
I have already done the embedding the text file into the lsb plane of an image. But i want to increase the capacity of text file and compress it and then embed it in an image.
So you use https://www.mathworks.com/matlabcentral/fileexchange/4900-huffman-code to do the Huffman compression and then you do the data hiding. What is your question?
My question is to compressed a text file then hide compressed file inside an image.
Step 1: read the text file
Step 2: call a huffman compression algorithm to produce a compressed version of the file
Step 3: convert the compressed data to binary
Step 4: hide the binary inside an image
Step 5: save the image.
Sanjeeb Behera
Sanjeeb Behera am 29 Sep. 2016
Bearbeitet: Walter Roberson am 3 Okt. 2016
Hi
Yes i have done this through a existing code. But output of the execution is not clear.
The output of the execution of what is not clear? Please clarify what you mean by not clear.
Sanjeeb Behera
Sanjeeb Behera am 3 Okt. 2016
Bearbeitet: Walter Roberson am 3 Okt. 2016
Here i have given execution code of above program
At first it require to read the file i.e paper4
Then it needs to enter the destination huffman code file name: paper5
Enter huffman table: table
Enter the destination file: paperx
paper5, table and paperx file created but no data is saved in this file.
So can u help me, how can i get correct result?

Melden Sie sich an, um zu kommentieren.

Usairum Mirza
Usairum Mirza am 16 Okt. 2019
Bearbeitet: Usairum Mirza am 16 Okt. 2019

0 Stimmen

A simple and easy way for encoding and decoding with a text file is give below:(We have used huffman functions in this code).
keep in mind make your text file in capital letters and with no nex line or comms or fullstop

2 Kommentare

but in this code Encoding is not mentioned. its only decoding
Usairum Mirza
Usairum Mirza am 3 Jun. 2020
Bearbeitet: Usairum Mirza am 10 Jul. 2020
By making a dictionay assigning their probabilities and using huffman commands like huffman enco this is where encoding part is. Also after running we can see the compression ratio or number of bits that are compressed just look it up.

Melden Sie sich an, um zu kommentieren.

Sai Sriram Sunkavalli
Sai Sriram Sunkavalli am 29 Aug. 2020

0 Stimmen

Consider the given file(James C. Maxwell.docx). Compute the probabilities of alphabet and number (ratio of the number of occurrences to the total count of alphabets and numerals) and create a table with symbols and probabilities. Determine the Huffman code for the symbols and create the table of symbols and Huffman codewords. Using the above constructed table encode your name and Roll number.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by