WolframAlpha.com
WolframCloud.com
All Sites & Public Resources...
Products & Services
Wolfram|One
Mathematica
Wolfram|Alpha Notebook Edition
Finance Platform
System Modeler
Wolfram Player
Wolfram Engine
WolframScript
Enterprise Private Cloud
Application Server
Enterprise Mathematica
Wolfram|Alpha Appliance
Enterprise Solutions
Corporate Consulting
Technical Consulting
Wolfram|Alpha Business Solutions
Resource System
Data Repository
Neural Net Repository
Function Repository
Wolfram|Alpha
Wolfram|Alpha Pro
Problem Generator
API
Data Drop
Products for Education
Mobile Apps
Wolfram Player
Wolfram Cloud App
Wolfram|Alpha for Mobile
Wolfram|Alpha-Powered Apps
Services
Paid Project Support
Wolfram U
Summer Programs
All Products & Services »
Technologies
Wolfram Language
Revolutionary knowledge-based programming language.
Wolfram Cloud
Central infrastructure for Wolfram's cloud products & services.
Wolfram Science
Technology-enabling science of the computational universe.
Wolfram Notebooks
The preeminent environment for any technical workflows.
Wolfram Engine
Software engine implementing the Wolfram Language.
Wolfram Natural Language Understanding System
Knowledge-based broadly deployed natural language.
Wolfram Data Framework
Semantic framework for real-world data.
Wolfram Universal Deployment System
Instant deployment across cloud, desktop, mobile, and more.
Wolfram Knowledgebase
Curated computable knowledge powering Wolfram|Alpha.
All Technologies »
Solutions
Engineering, R&D
Aerospace & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Mechanical Engineering
Operations Research
More...
Finance, Statistics & Business Analysis
Actuarial Sciences
Bioinformatics
Data Science
Econometrics
Financial Risk Management
Statistics
More...
Education
All Solutions for Education
Tech & Trends
Machine Learning
Multiparadigm Data Science
High-Performance Computing
Quantum Computation Framework
Software & Web
Software Development
Authoring & Publishing
Interface Development
Web Development
Sciences
Astronomy
Biology
Chemistry
More...
All Solutions »
Learning & Support
Learning
Wolfram Language Documentation
Fast Introduction for Programmers
Wolfram U
Videos & Screencasts
Wolfram Language Introductory Book
Webinars & Training
Summer Programs
Books
Need Help?
Support FAQ
Wolfram Community
Contact Support
Premium Support
Paid Project Support
Technical Consulting
All Learning & Support »
Company
About
Company Background
Wolfram Blog
Events
Contact Us
Work with Us
Careers at Wolfram
Internships
Other Wolfram Language Jobs
Initiatives
Wolfram Foundation
MathWorld
Computer-Based Math
A New Kind of Science
Wolfram Technology for Hackathons
Student Ambassador Program
Wolfram for Startups
Demonstrations Project
Wolfram Innovator Awards
Wolfram + Raspberry Pi
Summer Programs
More...
All Company »
Search
Legacy Documentation
Digital Image Processing
(2000)
This is documentation for an obsolete product.
Current products and services
User's Guide
Image Transforms
8.4 Discrete Cosine Transform
The discrete cosine transform (DCT) is an important transform in 2D signal processing. It is known to be close to optimal in terms of its energy compaction capabilities and can be computed via a fast algorithm. The DCT is used in two international image/video compression standards, Joint Photographic Experts Group (JPEG), and Motion Picture Experts Group (MPEG) [
Pen90
,
Pen93
].
Transform
Short
DiscreteCosineTransform
[
img
]
DCT[
img
]
discrete cosine transform of
img
InverseDiscreteCosineTransform
[
coef
]
IDCT[
coef
]
inverse discrete cosine transform of
coef
CosineMatrix
[
n
]
returns an
n
×
n
matrix of
n-
point cosine basis sequences
Cosine transform functions.
The 1D discrete cosine transform (1D DCT)
X[k] of a sequence x[n] of length N is defined as
The inverse DCT is defined as
where in both Equations (8.4.1) and (8.4.2)
[k] is defined as
The basis sequences of the 1D DCT are real, discrete-time sinusoids defined by
This loads the package.
In[1]:=
The series form of the 2D discrete cosine transform (2D DCT) pair of formulas is
for k
1
= 0,1,...,N
1
-1 and k
2
= 0,1,...,N
2
-1 and
for n
1
= 0,1,...,N
1
-1 and n
2
= 0,1,...,N
2
-1, with
[k] defined as in Equation (8.4.3). Equation (8.4.6) is called the analysis formula or the forward transform, while Equation (8.4.7) is the synthesis formula or inverse transform. The DCT is separable and so may be computed using 1D DCT row and column operations.
We conclude this section with examples of 1D and 2D DCTs of some simple signals. Consider the following sequence x[n] :
Here is the N=32 point DCT of this sequence.
In[2]:=
Out[2]=
Next, we show the 2D DCT of a box sequence.
This plots the result.
In[3]:=
Out[3]=
Here we demonstrate the DCT magnitude spectrum of an example image.
In[4]:=
Here is the original image and its discrete cosine transform.
In[6]:=
Out[6]=
Particularly note the concentration of large DCT coefficients in the low-frequency zone. The DCT is known to have excellent energy compaction properties.
Enable JavaScript to interact with content and submit forms on Wolfram websites.
Learn how »