Image wavelet transform principle _ image wavelet transform matlab implementation

Principle of wavelet transform

The so-called small wavelet is for the Fourier wave, and the Fourier wave refers to the sine (or cosine wave) that infinitely oscillates in the time domain space.

Relatively speaking, wavelet refers to a wave whose energy is very concentrated in the time domain. Its energy is limited, it is concentrated near a certain point, and the integral value is zero, which means that it is orthogonal to the Fourier wave. wave.

Give some examples of wavelets:

Image wavelet transform principle _ image wavelet transform matlab implementation

It can be seen that the energy is concentrated near the x-axis zero value, and the zero value of the y-axis is the baseline, and the waveform areas of the upper and lower regions are equal.

As is well known, the Fourier transform of an image is a decomposition of an image signal into sine waves of various frequencies. Similarly, wavelet transform is the decomposition of an image signal into a set of wavelets after displacement and scaling by the original wavelet.

Wavelet is called image microscopy in image processing because its multi-resolution decomposition capability can decompose image information layer by layer. The means of stripping is through low-pass and high-pass filters.

Here we take the horizontal one-dimensional of an image as an example to talk about the decomposition and reduction of wavelets, using Haar wavelet to do decomposition:

Image raw pixel matrix: [6 4 8 7 5 9 3 2]

Decompose the low pass filter: [ 1 1]/sqrt(2)

Decompose the high pass filter: [-1 1]/sqrt(2)

1. Convolve with the original pixel matrix using a low-pass filter: [8 10 12 15 12 14 12 5]/sqrt(2)

Downsampling: [10 15 14 5]/sqrt(2) -----"L

2. Convolve with the original pixel matrix using a high-pass filter: [-4 2 -4 1 2 -4 6 1]/sqrt(2)

Downsampling: [2 1 -4 1]/sqrt(2) -----"H

The above example is a one-dimensional case, and the two-dimensional case can be longitudinally filtered after the horizontal filtering is performed.

Second, the inverse transformation process:

Reconstruct low-pass filter: [1 1]/sqrt(2)

Reconstruct high-pass filter: [1 -1]/sqrt(2)

1. Insert the L array worth: [0 10 0 15 0 14 0 5]/sqrt(2)

Convolution with a low-pass filter: [10 10 15 15 14 14 5 5]/2

2. The value of the H array is inserted: [0 2 0 1 0 -4 0 1]/sqrt(2)

Then use the high-pass filter to convolve: [2 -2 1 -1 -4 4 1 -1]/2

The two arrays are summed: [6 4 8 7 5 9 3 2] and the matrix is ​​restored.

Third, image compression based on wavelet transform

We know that the low frequency part of the image preserves the contour information of the image, while the high frequency preserves the edge and detail information of the image. A large number of studies have shown that high frequency information with low amplitude is small for image sharing.

Discarding has little effect on image quality, so the characteristics of wavelet transform give image compression a good tool. After wavelet decomposition of the original image, set a threshold a for high frequency information, if the value of this point is less than a, then set Zero thus discards the low-amplitude high-frequency information that has little effect on the image, and the restored image has no obvious quality degradation, but the occupied space is smaller.

Give examples and statistics from someone else's paper:

Image wavelet transform principle _ image wavelet transform matlab implementation

effect:

Image wavelet transform principle _ image wavelet transform matlab implementation

Detailed explanation of the image wavelet transform matlab

1. Matlab implementation of one-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)

Description: [cA,cD]=dwt(X,'wname') Decomposes the signal X using the specified wavelet basis function 'wname', where cA and cD are approximate components and detail components, respectively; [cA,cD]=dwt( X, Lo_D, Hi_D) Decompose the signal using the specified filter banks Lo_D, Hi_D.

(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') The original signal X is reconstructed by inverse wavelet transform from the approximate component cA and the detail component cD.

'wname' is the selected wavelet function

X = idwt (cA, cD, Lo_R, Hi_R) The original signal X is reconstructed by inverse wavelet transform using the specified reconstruction filters Lo_R and Hi_R.

X=idwt(cA, cD, 'wname', L) and X=idwt(cA, cD, Lo_R, Hi_R, L) specify L points near the center of the return signal X.

2. Matlab implementation of 2D wavelet transform

Image wavelet transform principle _ image wavelet transform matlab implementation

(1) wcodemat function

Function: pseudo color coding of the data matrix

Format: Y=wcodemat(X,NB,OPT,ABSOL)

Y=wcodemat(X,NB,OPT)

Y=wcodemat(X,NB)

Y=wcodemat(X)

Description: Y=wcodemat(X, NB, OPT, ABSOL) returns the coding matrix Y of the data matrix X; the maximum value of the NB pseudo coding, that is, the coding range is 0 to NB, and the default value is NB=16;

OPT specifies how the encoding is done (default is 'mat'), ie:

OPT='row', encoded by line

OPT='col', encoded by column

OPT='mat', encoded by the entire matrix

ABSOL is the control parameter for the function (default is '1'), ie:

Return code matrix when ABSOL=0

When ABSOL=1, return 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 basis function 'wname' to perform two-dimensional discrete wavelet transform on the two-dimensional signal X; cA, cH, cV, cD are respectively Approximate component, horizontal detail component, vertical detail component, and diagonal detail component; [cA,cH,cV,cD]=dwt2(X,Lo_D,Hi_D) Decompose signal X using the specified decomposition low-pass and high-pass filters Lo_D and Hi_D .

(3) wavedec2 function

Function: Multi-layer wavelet decomposition of two-dimensional signals

Format: [C,S]=wavedec2(X,N,'wname')

[C,S]=wavedec2(X,N,Lo_D,Hi_D)

Description: [C,S]=wavedec2(X,N,'wname') N-layer decomposition of the two-dimensional signal X using the wavelet basis function 'wname'; [C,S]=wavedec2(X,N,Lo_D,Hi_D ) Decompose signal X using the specified decomposition low-pass and high-pass filters Lo_D and Hi_D.

(4) idwt2 function

Function: 2D 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)

X=idwt2(cA, cH, cV, cD, Lo_R, Hi_R, S)

Description: X=idwt2(cA,cH,cV,cD,'wname') The approximate signal cA and the detail signals cH, cH, cV, cD decomposed by the signal wavelet are reconstructed by inverse wavelet transform to reconstruct the original signal X; X=idwt2( cA, cH, cV, cD, Lo_R, Hi_R) reconstruct the original signal X using the specified reconstructed low-pass and high-pass filters Lo_R and Hi_R; X=idwt2(cA,cH,cV,cD,'wname',S) And X=idwt2 (cA, cH, cV, cD, Lo_R, Hi_R, S) returns S data points near the center.

(5) waverec2 function

Description: Multi-layer wavelet reconstruction of two-dimensional signals

Format: X=waverec2(C,S,'wname')

X=waverec2(C,S,Lo_R,Hi_R)

Description: X=waverec2(C,S,'wname') The result of multi-layer two-dimensional wavelet decomposition C, S reconstructs the original signal X, 'wname' is the wavelet basis function used; X=waverec2(C,S, Lo_R, Hi_R) Reconstruct the original signal using the reconstructed low-pass and high-pass filters Lo_R and Hi_R.

Image Processing Toolbox 1. Image and Image Data

By default, MATLAB stores the data in the image as a double (double), 64-bit floating point.

Number, the amount of storage required is large; MATLAB also supports another type of unsigned integer (uint8), ie image moment

Each data in the array occupies 1 byte.

When using the MATLAB toolbox, be sure to pay attention to the type of parameters required by the function. In addition, uint8

Unlike the value range of the double type data, programming needs to pay attention to the range conversion.

Image wavelet transform principle _ image wavelet transform matlab implementation

3. Image types supported by the image processing toolbox

3.1, true color image

The three components R, G, and B represent the color of one pixel. If you want to read the pixel value at (100, 50) in the image,

You can view the ternary data (100, 50, 1:3).

True color images can be stored in double precision, the brightness value range is [0, 1];

Symbol integer storage, brightness value range [0,255]

3.2, index color image

Contains two structures, one for the palette and one for the image data matrix. The palette is one with 3 columns and several rows

The color map matrix, each row of the matrix represents a color, and the three columns represent the double precision of the red, green, and blue intensities, respectively.

Note: Palette color intensity [0,1] in MATLAB, 0 means the darkest, 1 means the brightest.

Image wavelet transform principle _ image wavelet transform matlab implementation

Safety Light Curtain

SDKELI has been manufacturing safety light curtains for more than 20 years. Its brand [SHANGSHOU" and [SDKELI" owns largest market share in China because of reliable quality and proper price. All the safety light curtains are type 4 with CE certificate.

Safety Light Curtain,Safety Curtain,Laser Safety Light Curtain,Safety Optic Light Curtain,Security Light Curtain,Press Brake Safety Light Curtains

Jining KeLi Photoelectronic Industrial Co.,Ltd , https://www.sdkelien.com