- clear all;
- I = imread('cameraman.tif');
- I = im2bw(I, 0.4);
- [zipped, info] = RLEncode(I);
- unzipped = RLEdecode(zipped, info);
- %显示原始图像和经编解码后的图像,显示压缩比,并计算均方根误差得erms=0,
- %表示RLE是无失真编码。
- I2 = logical(unzipped);
- subplot(121);imshow(I);
- subplot(122);imshow(I2);
- erms = compare(I, I2)
- cr = info.ratio
- whos I unzipped zipped