Before it, i made a script about image compression use quantization algorithm. This algorithm is lossy compression, it means we can't decompression our image file after compression.
With RLE algorithm we can save all information in our image.... so nothing to loss. How RLE algorithm work? I will use 6x6 pixel grayscale image (8 degree grayscale) below:
1 1 1 7 1 34 4 6 1 2 2
7 7 7 5 5 5
6 4 4 2 2 2
5 5 2 2 2 1
2 3 3 3 0 0
RLE code is a number that contains color intensity and frequency of color intensity coming. Here, we get RLE code below:
1 3 7 1 1 1 3 1 4 2 6 1 1 1 2 2 7 3 5 3 6 1 4 2 2 3 5 2 2 3 1 1 2 1 3 3 0 2
And here source code to make RLE code.... that made with Matlab.
g is grayscale image. And RLE code in rle array. So we can decompression with very easily, because we save all information about image.
Tidak ada komentar:
Posting Komentar