longer course.
Let's see how we do that.
Let's see an example of the use of this.
So here, we have an image, and this is
actually the image that we saw in the
previous video, the geometric image.
This is a particular image that has,
there's only four different gray values
in that image, and they appear, and so
the pixels, pixels with gray value 87
appear in 1/4 on the image, so 25%,, 25%
or probabilty of 0.25.
And we also have 128 appearing almost
half of the time in the image, and we
also have 186 and 255 appears very, very
few times, everybody else just doesn't
appear in the image at all.
So, the standard way to represent this
image is we have an array and for every
pixel, we have a binary code with eight
bits.
So, we are going to basically represent
87 with its binary representation.
We are going to represent 128 with its,
its own binary representation and so on.
So, at the end, we are basically spending
eight bits per pixel if we don't
compress.
But let's assume that somehow I managed
to basically construct a code that is
shown here,
in a way that 87 is represented by the
binary code 01,
128 is represented by the binary code
one,
186 by the binary code 000 and 255 by the
binary code 001.
That means that, for example, if I want
to, if I want to store or send the pixels
87, 87,
255,
128.
Instead of writing all these then, this
again, for 255, this and for 128, this,
which will take me basically, 4 times 8,
32 bits and I'm going to write it in the
following way.
I'm going to say, okay,
87 is 01.
87 again, 01.
255,
001.
128, 1.
So, basically it took me two for seven,
eight bits instead of 32 to represent the
same stream the same form of gray values.
Now, the decoder has this table, so the
decoder will see 01, we'll go into that
pixel position and we'll put an 87.
We'll see 01, we'll put again an 87.