idct
Inverse discrete cosine transform.
| Library |
|
Arguments
Input arguments
# y is the input discrete cosine transform
+
vector | the matrix | An N-dimensional array
Details
The input discrete cosine transform, defined as a vector, matrix, or N-dimensional array with real or complex values.
| Типы данных |
|
| Support for complex numbers |
Yes |
# n is the length of the inverse transformation
+
a positive integer scalar
Details
The length of the inverse transformation, specified as a positive integer scalar.
| Типы данных |
|
Output arguments
# x is the inverse discrete cosine transform
+
vector | the matrix | An N-dimensional array
Details
The inverse discrete cosine transform, returned as a real or complex vector, matrix, or N-dimensional array.
Examples
Signal recovery using the inverse discrete cosine transform
Details
We will generate a signal consisting of a sine wave with a frequency of 25 Hz, sampled with frequency 1000 Hz during 1 seconds. White Gaussian noise with variance is added to the sine wave 0.01.
import EngeeDSP.Functions: randn
using Random
Random.seed!(1234)
Fs = 1000
t = 0:1/Fs:1-1/Fs
x = sin.(2π * 25 * t) + randn(length(t), 1) / 10
Let’s calculate the discrete cosine transformation (DCT) of the sequence. Let’s determine how many of 1000 The PREP coefficients are significant. Let’s choose a threshold of significance 1.
import EngeeDSP.Functions: dct
y = dct(x)
sigcoeff = abs.(y) .>= 1
howmany = sum(sigcoeff)
17
Reconstruct the signal using only significant components.
import EngeeDSP.Functions: idct
y[.!sigcoeff] .= 0
z = idct(y)
Let’s plot the original and reconstructed signals.
p1 = plot(t, x, title = "Original")
yl = ylims(p1)
p2 = plot(t, z, title = "Reconstructed")
ylims!(p2, yl)
plot(p1, p2, layout = (2, 1), legend = false)
Additional Info
Inverse discrete cosine transform
Details
The inverse discrete cosine transform reconstructs the sequence from its coefficients of the discrete cosine transform (DCT). Function idct is the inverse of the function dct.
PREP has four standard options. Only the DKP-2 type is implemented for this function. For the converted signal lengths and the Kronecker symbol The inverse transformations are defined as follows:
-
Reverse PREP-1:
-
Reverse PREP-2:
-
Reverse PREP-3:
-
Reverse PREP-4:
The rows are indexed from and instead of the usual ones and since the Engee vectors vary from before , not from before .
All PREP variants are unitar (or, equivalently, _orthogonal): to find direct transformations, swap and in every definition. DKP-1 and DKP-4 are the opposite of each other. DKP-2 and DKP-3 are the opposite of each other.
Literature
-
Jain, A. K. Fundamentals of Digital Image Processing. Englewood Cliffs, NJ: Prentice-Hall, 1989.
-
Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck. Discrete-Time Signal Processing. 2nd Ed. Upper Saddle River, NJ: Prentice Hall, 1999.
-
Pennebaker, W. B., and J. L. Mitchell. JPEG Still Image Data Compression Standard. New York: Van Nostrand Reinhold, 1993.