一维DCT
F
(
u
)
=
c
(
u
)
∑
i
=
0
N
−
1
f
(
i
)
c
o
s
(
(
i
+
0.5
)
π
N
u
)
F(u)=c(u)\sum_{i=0}^{N-1}{f(i)cos(\frac{(i+0.5)\pi}{N}u)}
F(u)=c(u)∑i=0N−1f(i)cos(N(i+0.5)πu)
c
(
u
)
=
{
1
N
u
=
0
2
N
u
≠
0
c(u)=\left\{ \begin{aligned} \sqrt{\frac{1}{N} } && u=0\\ \sqrt{\frac{2}{N} } && u\neq 0\\ \end{aligned} \right.
c(u)=⎩⎪⎪⎪⎨⎪⎪⎪⎧N1N2u=0u=0
f
(
i
)
f(i)
f(i)为原始的信号,F(u)是DCT变换后的系数,N为原始信号的点数,c(u)可以认为是一个补偿系数,可以使DCT变换矩阵为正交矩阵
一维IDCT
f
(
i
)
=
c
(
u
)
∑
u
=
0
N
−
1
F
(
u
)
c
o
s
(
(
i
+
0.5
)
π
N
u
)
f(i)=c(u)\sum_{u=0}^{N-1}{F(u)cos(\frac{(i+0.5)\pi}{N}u)}
f(i)=c(u)∑u=0N−1F(u)cos(N(i+0.5)πu)
c
(
u
)
=
{
1
N
u
=
0
2
N
u
≠
0
c(u)=\left\{ \begin{aligned} \sqrt{\frac{1}{N} } && u=0\\ \sqrt{\frac{2}{N} } && u\neq 0\\ \end{aligned} \right.
c(u)=⎩⎪⎪⎪⎨⎪⎪⎪⎧N1N2u=0u=0
f
(
i
)
f(i)
f(i)为原始的信号,F(u)是DCT变换后的系数,N为原始信号的点数,c(u)可以认为是一个补偿系数
过程推导:详解离散余弦变换(DCT)
更多参考:DCT变换、DCT反变换、分块DCT变换