Skip to content

Instantly share code, notes, and snippets.

@Anant-mishra1729
Created March 6, 2023 02:24
Show Gist options
  • Save Anant-mishra1729/8a4301b52c5f2b88742c34d96fdba31a to your computer and use it in GitHub Desktop.
Save Anant-mishra1729/8a4301b52c5f2b88742c34d96fdba31a to your computer and use it in GitHub Desktop.
Compute discrete cosine transform
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