Created
March 6, 2023 02:24
-
-
Save Anant-mishra1729/8a4301b52c5f2b88742c34d96fdba31a to your computer and use it in GitHub Desktop.
Compute discrete cosine transform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
# Using OpenCV | |
def _dct(image): | |
result = cv2.dct(np.float32(image)/255.0) | |
return (result * 255.0) | |
# Using Scipy | |
from scipy.fftpack import dctn | |
dctn(image, norm = "ortho") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment