This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

vision.DCT System object

Compute 2-D discrete cosine transform


The DCT object computes a 2-D discrete cosine transform. The number of rows and columns of the input matrix must be a power of 2.


Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


H = vision.DCT returns a discrete cosine transform System object, H, used to compute the two-dimensional discrete cosine transform (2-D DCT) of a real input signal.

H = vision.DCT(Name,Value) returns a discrete cosine transform System object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).



Specify how the System object computes sines and cosines as Trigonometric function, or Table lookup. This property must be set to Table lookup for fixed-point inputs.

 Fixed-Point Properties


stepCompute 2-D discrete cosine transform on input
Common to All System Objects

Create System object with same property values


Expected number of inputs to a System object


Expected number of outputs of a System object


Check locked states of a System object (logical)


Allow System object property value changes


Use 2-D discrete cosine transform to analyze the energy content in an image. Set the DCT coefficients lower than a threshold of 0, and then reconstruct the image using the 2-D inverse discrete cosine transform object.

 hdct2d = vision.DCT;
 I = double(imread('cameraman.tif'));
 J = step(hdct2d, I);
 imshow(log(abs(J)),[]), colormap(jet(64)), colorbar
 hidct2d = vision.IDCT;
 J(abs(J) < 10) = 0;
 It = step(hidct2d, J);
 figure, imshow(I, [0 255]), title('Original image')
 figure, imshow(It,[0 255]), title('Reconstructed image')


This object implements the algorithm, inputs, and outputs described on the 2-D DCT block reference page. The object properties correspond to the block parameters.

Extended Capabilities

See Also

Introduced in R2012a