1. Realization of Matlab with discrete Fourier transform
The Matlab function FFT, fft2 and fftn can implement one-dimensional, two-and N-dimensional DFT algorithms respectively, while functions Ifft, ifft2 and ifftn are used to calculate the inverse DFT. These functions are called in the following format:
A=fft (X,n,dim)
where x represents the input image, n represents the sampling interval, and if x is less than the value, then Matlab will fill the x 0, otherwise it will be truncated so that it is N; DIM indicates a discrete Fourier transform.
A=FFT2 (X,mrows,ncols)
where Mrows and NCOLS specify an x size of 0 padding for x.
A=FFTN (X,size)
Where SIZE is a vector, each element will specify the length of the X corresponding dimension after 0 padding.
The call formats of the functions Ifft, ifft2, and ifftn are identical to the corresponding discrete Fourier transform functions.
Example: two-dimensional Fourier spectrum of images
% read in original image
I=imread (' lena.bmp ');
Imshow (I)
% seeking discrete Fourier spectrum
J=fftshift (fft2 (I));
Figure
Imshow (log (ABS (J)), [8,10])
2. Matlab implementation of discrete cosine transform
2.1. dCT2 function
Function: Two-dimensional DCT transform
Format: B=idct2 (A)
B=idct2 (A,m,n)
B=idct2 (A,[m,n])
Description: B=idct2 (a) calculates the DCT inverse of a, B, the same size as B, B=idct2 (A,m,n) and B=idct2 (A,[m,n]) by a complement of 0 or clipping, so that the size of B is MXN.
2.3. dctmtx function
function: Calculate the DCT transformation matrix
Format: D=DCTMTX (n)
Description: D=DCTMTX (n) returns a NXN DCT transformation matrix with the output matrix D as a double type.
3. Matlab implementation of Image wavelet transform
3.1 Matlab implementation of a dimensional wavelet transform
(1) DWT function
function: one-dimensional discrete wavelet transform
Format: [CA,CD]=DWT (X, ' wname ')
[Ca,cd]=dwt (X,lo_d,hi_d)
Note: [Ca,cd]=dwt (X, ' Wname ') uses the specified wavelet function ' wname ' to decompose the signal X, and the CA and CD are approximate components and detail components respectively; [CA,CD]=DWT (X,lo_d,hi_d) uses the specified filter group lo_d, Hi_ D the signal is decomposed.
(2) IDWT function
function: one-dimensional discrete wavelet inverse transform
Format: X=IDWT (CA,CD, ' wname ')
X=IDWT (Ca,cd,lo_r,hi_r)
X=IDWT (CA,CD, ' wname ', L)
X=IDWT (ca,cd,lo_r,hi_r,l)
Description: X=IDWT (CA,CD, ' wname ') reconstructed the original signal X by the wavelet inverse transform by the approximate component CA and the detail component CD.
' Wname ' is the selected wavelet function
X=IDWT (Ca,cd,lo_r,hi_r) reconstructs the original signal X with the specified reconstruction filter lo_r and hi_r by wavelet inverse transform.
X=IDWT (CA,CD, ' wname ', L) and X=IDWT (ca,cd,lo_r,hi_r,l) Specify the L point near the center of the return signal X.
3.2 Matlab implementation of two-dimensional wavelet transform
Functions of two-dimensional wavelet transform
-------------------------------------------------
Function name function function
---------------------------------------------------
Dwt2 Two-dimensional discrete wavelet transform
Multi-layer wavelet decomposition of wavedec2 two-dimensional signal
Idwt2 Two-dimensional discrete wavelet inverse transformation
Multi-layer wavelet reconstruction of waverec2 two-dimensional signal
Wrcoef2 reconstruction of a layer by multi-layer wavelet decomposition
UPCOEF2 reconstruction of approximate component or detail component by multi-layer wavelet decomposition
Detcoef2 extracting the detail component of wavelet decomposition of two-dimensional signal
Appcoef2 extracting approximate component of wavelet decomposition of two-dimensional signal
Single-layer reconstruction of upwlev2 two-dimensional wavelet decomposition
Dwtpet2 Two-dimensional periodic wavelet transform
Idwtper2 Two-dimensional periodic wavelet inverse transformation
-------------------------------------------------------------
(1) Wcodemat function
function: pseudo-color coding of data matrix
Format: Y=wcodemat (X,nb,opt,absol)
Y=wcodemat (x,nb,opt)
Y=wcodemat (X,NB)
Y=wcodemat (X)
Note: Y=wcodemat (X,NB,OPT,ABSOL) returns the encoding matrix Y of the data matrix X, the maximum value of NB pseudo-code, that is, the encoding range is 0~NB, the default value nb=16;
OPT Specifies the encoding method (the default value is ' mat '), i.e.:
opt= ' Row ', encoded by line
Opt= ' col ', coded by column
Opt= ' mat ', encoded by the entire matrix
Absol is the control parameter of the function (the default value is ' 1 '), i.e.:
Absol=0, the encoding matrix is returned
Absol=1, returns the absolute value of the data Matrix ABS (X)
(2) Dwt2 function
Function: two-dimensional discrete wavelet transform
Format: [Ca,ch,cv,cd]=dwt2 (X, ' wname ')
[Ca,ch,cv,cd]=dwt2 (X,lo_d,hi_d)
Description: [Ca,ch,cv,cd]=dwt2 (X, ' Wname ') uses the specified wavelet function ' Wname ' to two-dimensional discrete wavelet transform of two-dimension signal X, CA,CH,CV,CD are approximate component, horizontal detail component, vertical detail component and diagonal detail component respectively; [CA, CH,CV,CD]=DWT2 (x,lo_d,hi_d) uses the specified decomposition low-pass and high-pass filter lo_d and hi_d decomposition signal X.
(3) WAVEDEC2 function
Function: Multi-layer wavelet decomposition of two-dimensional signal
Format: [C,s]=wavedec2 (X,n, ' wname ')
[C,s]=wavedec2 (X,n,lo_d,hi_d)
Description: [C,s]=wavedec2 (X,n, ' Wname ') uses the wavelet function ' Wname ' to perform N-layer decomposition of the two-dimensional signal X; [C,S]=WAVEDEC2 (X,n,lo_d,hi_d) uses the specified decomposition low-pass and high-pass filters Lo_d and Hi_d Decomposition signal X.
(4) Idwt2 function
Function: two-dimensional discrete wavelet inverse transform
Format: X=idwt2 (CA,CH,CV,CD, ' wname ')
X=IDWT2 (Ca,ch,cv,cd,lo_r,hi_r)
X=idwt2 (CA,CH,CV,CD, ' wname ', S)