Can anyone provide me with the matab code for Huffman encoding to compress an image?

3 ビュー (過去 30 日間)
Nidhi Kumari
Nidhi Kumari 2018 年 8 月 26 日
コメント済み: Walter Roberson 2020 年 8 月 31 日
I am new to matab and have to write the code for Huffman encoding. I found many functions to apply Huffman encoding but i am not able to write the rest of the code or to use that function. So it would be very helpful if anyone can provide me the code from starting to end for image compression using Huffman encoding and for decoding too.
  2 件のコメント
hamza munawar
hamza munawar 2020 年 8 月 31 日
do yo apply huffman encoding in a 2D image???
Walter Roberson
Walter Roberson 2020 年 8 月 31 日
You CAN apply Huffman coding to a 2d image.

サインインしてコメントする。

回答 (2 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 8 月 26 日
Check here
Also here
  5 件のコメント
Nidhi Kumari
Nidhi Kumari 2018 年 8 月 29 日
I want to take an image as input and save the compressed form.
Walter Roberson
Walter Roberson 2018 年 8 月 29 日
You have
sig_encoded=huffmanenco(string,dict)
The variable sig_encoded is the compressed image. It has one bit of usable information for each vector location.
You can write the compressed image to file using one bit per location, if you use fwrite() with 'bit1' conversion specification.
Note that really you should also write the dictionary to the file as well. You do not need to write the probabilities, but you do need to write the table of which bit combinations correspond to which symbol. You also need to find a way of writing into the file information about where the bit stream stops, because it is not possible to stop writing in the middle of a byte. You probably also want to write information about the image size so that you know how to rearrange the decoded bits.

サインインしてコメントする。


Walter Roberson
Walter Roberson 2018 年 8 月 28 日

カテゴリ

Help Center および File ExchangeDenoising and Compression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by