What happens to Huffman in this case (compressing image)

76 Views Asked by At

I was wondering , what happens to Huffman coding when the pixels are similar, so basically Huffman uses probability of each symbol and worth through it.

what happens if the image was like this:

1 2 3 4 5 6

1 2 3 4 5 6

1 2 3 4 5 6

ect. does Huffman coding fails here?

1

There are 1 best solutions below

0
Mark Adler On

No, it doesn't fail at all. If your images were stored with eight bits per pixel, now they will be stored with, on average, 2.67 bits per pixel. Compressed by a factor of three.

While the symbols all have equal probability, there are only six of them. That permits Huffman coding to use fewer bits per symbol.