Let us now complete the week on image and video compression, by just a very brief

description of run-length coding. Run-length coding is very useful for,

normally, when we, when I encode binary images.

So let's just draw a binary image. And then we have a box to illustrate

that. Let's assume we have an object here that

has a certain grade value. And we only have two grade values.

Let's say, 100 in the background, and. 200 here.

Okay? So we already have seen that if we do a

small representation of our image we're going to be able to compress a lot.

As my representation means lets give to half on codeine very nice distributions,

very simple things and hopefully less than we will get by encoding the whole

thing. So of course we could encode this image

by saying many times one hundred for the first row, same for the second row, and

so on and so on. And imagine that this is you know 10,000.

by 10000 image. So, we're going to say 10,000 times 100,

and we keep going. A smarter way, is basically to do the

following. To say okay, let's just count how many

times they reach the value of 100. Let's just count how many times there is

the value 200. And let's count then after that how many

times there is again the value 100. Basically this count we don't have to do

if we know that there is only one transition.

So we count these and let's say that there is basically 3,000 times.

3000 times the value 100. So we still have encoding 3,000 times

100, we encode this value. And then let's assume that there is a

1,000 times. Again, the value 200, so we put.

3,000 then we put 1,000 and we're done, if we assume that it was only one object,

one transition. If not, we can keep going.

So, by two numbers, we have encoded the whole row.

And then we go to the next one, and we do the same.

And this is called run-length coding, because it basically enclosed the run of

equal numbers. We actually, indirectly, have seen that

in JPEG already when we were in the transformed domain of JPEG and eight by

eight. I'm just drawing a part of this.

And I say to you, I explain to you that when everything becomes zero, there is a

code that says, end of block. That's basically encoding by basically

one number, everything that is going to happen, to the end.

And that's a basic idea of run length coding, again very useful for images, in

particular for, basically, geometric images,

binary images, and indirectly was using JPEG but is very popular here.

And even if we have more than one object and an area over here basically call the

runs. We say how many times there is 100? How

many times 200? How many times again 100? How many time again 200 or any other

value if needed. We encode the value and how many times it

appears and with that we basically compress a lot.

This very, very simple images that otherwise would take us a very, very long

codes to represent. And as before we could just encode these

numbers, as they are, or we could flag them in, into Huffman coding, and

basically compress them even further. With this, we basically complete the week

on image and video compression. And now we have images, now we can

receive images from, every place. We can compress, we can store.

Next week we're going to start to process them.

And what happens when basically our images are not as, they don't look as

nice as I wanted them to look? So that's what starts next week.

See you next week. Thank you.