powered by
DCT2D computes two dimensional discrete cosine transformation. IDCT2D computes two dimensional inverse discrete cosine transformation.
DCT2D(imormat, returnmat = FALSE)IDCT2D(imormat, returnmat = FALSE)
IDCT2D(imormat, returnmat = FALSE)
a grayscale image of class cimg or a numeric matrix
if returnmat is TRUE, returns numeric matrix. if FALSE, returns a grayscale image of class cimg.
Makhoul, J. (1980). A fast cosine transform in one and two dimensions. IEEE Transactions on Acoustics, Speech, and Signal Processing. 28 (1): 27-34.
# NOT RUN { g <- grayscale(boats) layout(matrix(1:2, 1, 2)) plot(g, main = "Original") gg <- DCT2D(g) %>% IDCT2D() %>% plot(main = "Transformed") mean((g - gg)^2) # }
Run the code above in your browser using DataLab