Filter löschen
Filter löschen

file size for encoded image by huffman

3 Ansichten (letzte 30 Tage)
nor saziana ariani sazali
nor saziana ariani sazali am 29 Jun. 2021
Beantwortet: Pramil am 21 Feb. 2024
Hi,anyone can help me how to get file size for image compressed after huffman encode. As i need to find the compression ratio and size of table for compressed image. To store the dictionary and get the size of compressed image.

Antworten (1)

Pramil
Pramil am 21 Feb. 2024
I assume that you are using MATLAB's built-in “huffmandict” function to create a Huffman dictionary based on the symbol probabilities and using MATLAB's “huffmanenco” function for generating the encoded image.
You can calculate the size of compressed data in bits by simply finding the length of the encoded data using the "length" function. Divide the same by 8 to get the size of compressed data in bytes.
Now, to find the size of your Huffman dictionary, it will depend upon how you have implemented or stored it. For example, if you save it to a file, you can use “<filename>.bytes” to get the size of your Huffman dictionary.
Finally, to calculate the compression ratio, add the compressed file size and the dictionary size and divide the answer by the file size of the original image.
You can find an example in the file that I have attached.

Kategorien

Mehr zu Denoising and Compression finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by