inpystem.tools.dct module¶
This module defines some functions related to DCT decomposition including:
direct and inverse normalized 2D DCT transform,
direct and inverse band-by-band DCT transform for multi-band data.
2D transformations¶
-
inpystem.tools.dct.
dct2d
(a)¶ Computes the 2D Normalized DCT-II.
- Parameters
X ((m, n) numpy array) – 2D image.
- Returns
DCT coefficient matrix.
- Return type
(m, n) numpy array
-
inpystem.tools.dct.
idct2d
(a)¶ Computes the 2D Normalized Inverse DCT-II.
- Parameters
A ((m, n) numpy array) – DCT coefficient matrix
- Returns
2D image.
- Return type
(m, n) numpy array
Band-by-band transformations¶
-
inpystem.tools.dct.
dct2d_bb
(x, shape=None)¶ Computes the band-by-band 2D Normalized DCT-II
If the input X is a 3D data cube, the 2D dct will be computed for each 2D images staked along the 2nd axis.
- Parameters
X ((l, m*n) or (m, n, l) numpy array) – 2D or 3D multi-band data. If the data has 3 dimensions, the last axis is for spetra. If the data is 2D, the first axis is for spectra.
shape (optional, (m, n, l) tuple) – This is the data shape. This parameter is required only if input data are 2D.
- Returns
DCT coefficient matrix.
- Return type
(l, m*n) or (m, n, l) numpy array
-
inpystem.tools.dct.
idct2d_bb
(a, shape=None)¶ Computes the band-by-band inverse 2D Normalized DCT-II
If the input a is a 3D data cube, the 2D dct will be computed for each 2D images staked along the 2nd axis.
- Parameters
A ((l, m*n) or (m, n, l) numpy array) – 2D or 3D multi-band data DCT decomposition. If the data has 3 dimensions, the last axis is for spetra. If the data is 2D, the first axis is for spectra.
shape (optional, (m, n, l) tuple) – This is the data shape. This parameter is required only if input data are 2D.
- Returns
The image matrix.
- Return type
(l, m*n) or (m, n, l) numpy array