Borrar filtros
Borrar filtros

file size for encoded image by huffman

3 visualizaciones (últimos 30 días)
nor saziana ariani sazali
nor saziana ariani sazali el 29 de Jun. de 2021
Respondida: Pramil el 21 de Feb. de 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.

Respuestas (1)

Pramil
Pramil el 21 de Feb. de 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.

Categorías

Más información sobre Denoising and Compression en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by