필터 지우기
필터 지우기

file size for encoded image by huffman

조회 수: 3 (최근 30일)
nor saziana ariani sazali
nor saziana ariani sazali 2021년 6월 29일
답변: Pramil 2024년 2월 21일
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.

답변 (1개)

Pramil
Pramil 2024년 2월 21일
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.

카테고리

Help CenterFile Exchange에서 Denoising and Compression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by