Problems and solutions of wavelet image decomposition and reconstruction program

Source: Internet
Author: User

Last November, a series of articles on wavelet transform and image processing were published, and the experiences and programs in the process of learning wavelet were put on the internet and shared with everyone. Six months, thank you for your attention and help, in the mutual discussion and exchange, I constantly from the questions raised by everyone to expand their knowledge, the theory of wavelet and its application has a more in-depth understanding and mastery. Indeed, sharing is the eternal way of knowledge.

Next there is a new subject, and to prepare for the test Bo, the expedition will start a new exploration. Before this, you have to tidy up the blog post, according to and we discuss the issues found in the communication, the program in the blog to Amend. Today's article, is the wavelet image decomposition and reconstruction program to make important corrections, this program is to understand the wavelet, using the most fundamental of the wavelet, we hope to learn from the wavelet help.

First of all, I originally published the Wavelet image decomposition refactoring of the problems in the article. The relevant articles are:

1. Write your own MATLAB program for decomposition and reconstruction of wavelet signals
Http://blog.csdn.net/chenyusiyuan/archive/2007/11/13/1881781.aspx

2. wavelet image decomposition and reconstruction using self-programmed program
Http://blog.csdn.net/chenyusiyuan/archive/2007/11/13/1881940.aspx

The problems of its existence are:

(1) The small wave function used in the program is only non-standard Haar wavelet, its filter group is LO_D=[1/2], HI_D=[-1/2 1/2], is cured in the program of MYDWT2.M, can not choose other wavelet function;

(2) non-standard Haar wavelet, the decomposition of the coefficient matrix, the high-frequency coefficient of detail (contour, edge and other characteristics) is not obvious;

(3) The Matrix object of the column transformation in the function mydwt2 is the input matrix, which is wrong, and its matrix object should be the cache matrix after the row transformation;

(4) The output of the function mydwt2 is indicated by [LL,HL,LH,HH], which is not very canonical and should be replaced by [CA,CV,CH,CD] to indicate that the coefficient matrix of the first-stage wavelet transform output has 4 parts: The average part, the vertical detail part, the horizontal detail part and the diagonal detail part.

(5) The output of the function Mydwt2 [ll,hl,lh,hh], HL takes the Pock transformation and column transformation resulting matrix of the lower left part, that is, the vertical detail part, but in the final display results HL is in the upper right corner of the position; Similarly, LH takes the row, the column transforms the matrix the upper right part, That is, the level of detail, but the final display position is in the lower left corner, then the definition, I see from the textbook wavelet decomposition of the matrix of the average, the details of the distribution from top to bottom, from left to right: The average part, the level of detail, vertical details, diagonal detail part. But through programming and careful analysis, I found that the distribution order should be the average part, the vertical details, the level of detail, the diagonal details of the position, that is, the level and details of the location of the swap, the specific process will give a diagram, I hope to discuss with you which order is correct.

(5) The output Y of the function mywavedec2 is a matrix of the same size as the input matrix X, and all the average and detail coefficients of the N-level decomposition are combined into one. In fact, this definition is only valid for Haar wavelets. Because for the Haar wavelet, its filter length is only 2, the input sequence and the filter coefficient convolution, the output sequence and the input sequence length is the same (in MATLAB, if the signal length is n, the filter length is 2N, then the length of the CA and CD after the wavelet decomposition is: LNF = Floor (n-1 )/2) +n, if 2n=2, then lnf*2 = N), so that the wavelet coefficient matrix and image matrix is the same size. If you use other types of wavelets, because 2N > 2,lnf*2 > N, so that the coefficient matrix of the function Mydwt2 output is larger than the input matrix, then the output y of MYWAVEDEC2 will show the problem of the average and detail part of the boundary overlap. This shows that trying to combine the average and detail coefficients to show the tower structure of wavelet decomposition is theoretically infeasible, at least for MATLAB. Of course, by the formula LNF = Floor ((n-1)/2) +n, we can intercept the convolution sequence, so that the convolution output sequence and the input sequence length is the same, but through the implementation of the program to find the next level of decomposition errors, so the function mywavedec2 output y format to be adjusted appropriately.

(6) The original program to call the Modmat function to trim the image matrix, so that it can be divided by 2 of the N-square, mainly for the generation of tower structure image and set, the above problem is corrected, the Modmat function is no longer necessary to use.

In response to the above questions, I have made the following amendments to the procedure:

(1) The input parameter of the function MYWAVEDEC2/MYWAVEREC2 increases the wavelet function ' Wname ', and can select any type of wavelets function to decompose and reconstruct the image. Accordingly, the MATLAB function wfilters is called to find the Decomposition filter group coefficients [lo_d,hi_d] and the reconstruction filter group coefficients [lo_r,hi_r] of the wavelet function.

(2) The output of the function mydwt2 should be changed to [CA,CV,CH,CD] to indicate, notice the position distribution of the 4 parts: CA in the upper left corner of the coefficient matrix, CV in the upper right corner, CH in the lower left corner, CD in the lower right corner.

(3) The column transformation of the function mydwt2, whose processing object is changed from the input matrix X to the X1 of the row transform, and the buffer matrix X2 is obtained after the column transformation. The output CA takes the upper left corner of the X2 1/4 part, the CV takes X2 the upper right corner 1/4 part, CH takes the X2 the lower left corner 1/4 part, the CD takes X2 the lower right corner 1/4 part.

(4) The output y format of the function mywavedec2 is similar to the wavedec2 of MATLAB, but mine is in the format of "cell Matrix", and the WAVEDEC2 is the output wavelet coefficients in the format of "vector sequence". The result display method of wavelet decomposition no longer uses the tower structure method, but uses the subplot function to display the average and the detail coefficients of all levels.

(5) The reconstruction function mywaverec2 according to the decomposition function MYWAVEDEC2 output format to make the corresponding modification, the procedure is more concise, easy to understand and reasonable. and the reconstruction series of MYWAVEREC2 can be different from the Decomposition series, which can realize different levels of wavelet reconstruction.


(6) In the row and column transformation of the function myidwt2, the convolution output sequence is cropped to eliminate the influence of the decomposition filter and the reconstruction filter on the sequence length, so that the size of the reconstructed matrix is consistent with the coefficient matrix of the previous decomposition level.

The above is the main correction point, more detailed changes to the information, please see the next article gives the program and its comments.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.