1 简介
BTC编码又称方块编码,是一种有效,快速,简单的有损灰度图像数字压缩技术,具有性能高,信道容错力高等特点,在实时图像传输方面具有很高的应用价值,由美国普渡大学的Mitchell和Delphi教授提出.使用Mat-lab实现BTC编码.
2 完整代码
%Block Truncation Coding, or BTC, is a type of lossy image compression
%technique for greyscale images
%% Prepare Workspace
tic
clear;close all;
%% Input Image
I=imread('elaine.png');
if size(I,3)==3
I=rgb2gray(I);
end
%size of image
[M,N]=size(I);
%convert to double
I=double(I);
Y=zeros(M,N);
%% compression
blksize=2; %Block Size
mu=colfilt(I,[blksize,blksi