离散余弦变换
离散余弦变换(ransform,简称DCT变换)是一种与傅立叶变换紧密相关的数学运算。在傅立叶级数展开式中,如果被展开的函数是实偶函数,那么其傅立叶级数中只包含余弦项,再将其离散化可导出余弦变换,因此称之为离散余弦变换。
DCT原理
二维的DCT
其中m,k=0,1,…,M-1; n,=0,1,…,N-1。
二维逆离散余弦变换(IDCT)的定义如下:
DCT到DFT的映射是非常具有吸引力的,因为我们可以利用FFT类型算法的多种变化。
推导:
设
对做DCT变换,用替换,得
对做DFT变换,用欧拉公式展开,得
很容易得出,
从而我们可以用FFT计算DCT
MATLAB实现
例1
%mands pute the discrete cosine transform for the autumn
%image. Notice that most of the energy is in the upper left corner.
RGB = imread('');
I = rgb2gray(RGB);
J = dct2(I);
imshow(log(abs(J)),[]), colormap(jet(64)), colorbar
%Now set values less than magnitude 10 in the DCT matrix to zero, and then
%reconstruct the image using the inverse DCT function idct2.
J(abs(J) < 10) = 0;
K = idct2(J);
imview(I)
imview(K,[0 255])
J的部分数据
29785
-
1621
-
2102
-
-
13557
-
-
-
10940
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
1174
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
离散余弦变换 来自淘豆网www.taodocs.com转载请标明出处.