spyrit.misc.walsh_hadamard.iwalsh2_Sļ
- spyrit.misc.walsh_hadamard.iwalsh2_S(Y, T=None)[source]ļ
Inverse Fast Walsh S-transform of Y in ā2Dā
- Args:
Y(np.ndarray): n-by-n signal. n**2 should be a power of two.T(np.ndarray): Inverse S-matrix- Returns:
np.ndarray: n-by-1 S-transformed signal
- Examples:
>>> import spyrit.misc.walsh_hadamard as wh >>> import numpy as np >>> X = np.array([[1, 3, 0, 8],[7, 5, 1, 2],[2, 3, 6, 1],[4, 6, 8, 0]]) >>> print(f"image:\n {X}") image: [[1 3 0 8] [7 5 1 2] [2 3 6 1] [4 6 8 0]] >>> Y = wh.walsh2_S(X) >>> print(f"s-transform:\n {Y}") s-transform: [[ 0. 30. 27. 33.] [37. 33. 26. 26.] [32. 16. 29. 25.] [35. 33. 38. 28.]] >>> Z = wh.iwalsh2_S(Y) >>> print(f"inverse s-transform:\n {Z}") inverse s-transform: [[0. 3. 0. 8.] [7. 5. 1. 2.] [2. 3. 6. 1.] [4. 6. 8. 0.]]
Note that the first pixel is not meaningful and arbitrily set to 0.