Azzera filtri
Azzera filtri

file size for encoded image by huffman

3 visualizzazioni (ultimi 30 giorni)
nor saziana ariani sazali
nor saziana ariani sazali il 29 Giu 2021
Risposto: Pramil il 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.

Risposte (1)

Pramil
Pramil il 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.

Categorie

Scopri di più su Denoising and Compression in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by