Several problems in designing the wavelet transform program using Matlab-Good night, moon-wutao5935-and Wechat blog

Source: Internet
Author: User

Guidance:

In useMATLABIn the process of completing the wavelet transform program and compressing images through the threshold, I and many of my colleagues are learning and using it, and gradually understanding the wavelet andMATLABEditing

Write Program. Therefore, I am willing to discuss with you my personal experience in problem solving and hope to help people who encounter the same problem. In the online interactive learning method advocated by Lin fuzong of Tsinghua University

The open and honest discussions between teachers and students, especially the attitudes and practices inspired by Teacher Lin, will be of great significance for me to become a qualified graduate student in Tsinghua in the future, in this article, I would like to express my guidance to him

Respect!






  1. Introduction

  2.  



    This article consists of three parts: We still need to discuss how to use MATLAB to design wavelet standard and standard decomposition, and how to use wavelet transform to compress images.Each part is described in the form of problems and examples. for reference, the appendix provides some source code for your reference.

    When I completed my homework, I took a lot of detours. Finally, I read the 3--5 section of chapter 3 of the instructor's lecture documents repeatedly, and understood some basic knowledge about wavelet transformation, in this case, I mainly follow the example in Chapter 3 to make examples of Haar transformation using Matlab, which at least has no problem in completing Level 3 decomposition and synthesis of non-standard Haar wavelet, moreover, the computing speed is much faster than the one-dimensional transformation.Dwt2AndWavedec2. In addition, through the study of these short examples, we can also understand the basic knowledge and principles of wavelet transform from the perspective of practice, I think mastering wavelet is more important than simply using dwt2 for direct analysis. In order to give some reference to those who use one-dimensional transformations or intend to use convolution to complete the decomposition and reconstruction program, I also provided the code and ideas I previously wrote for your reference. In image compression tasks, I personally suggest usingWdencmpThe reason is that it is simple and reliable, and can generate demonstration files and PNG files that require wavelet compression and reconstruction. In the final part, I will focus on explaining and discussing the problem that the PNG file of the reconstructed image will become larger after the use of wavelet compression. I hope that you will be able to study it in depth.



  3. How to Use
  4. MATLAB Design of wavelet standards and standard Decomposition



    1. Use
    2. Standard and non-standard decomposition and reconstruction programs for image files written by Haar and DB9 Wavelet

      In essence, the task Book stipulates that one of the four programs should be written first:Hal (Haar) wavelet standard decomposition reconstruction program; Daubechies 9 wavelet standard decomposition reconstruction program; Hal (Haar) wavelet non-standard decomposition reconstruction program; Daubechies 9 wavelet non-standard decomposition Reconstruction Program. If you use the standard method, you need to generate a series of images 3-25. If you use a non-standard method, you need to generate a series of images in Figure 3-26.

      I personally compiled a non-standard decomposition and reconstruction program and summarized the public methods published by the online students. I think there are three methods to achieve this. However, the premise is that you must carefully read section 3.3, 3.4, and section 3.5 of Chapter 3 "wavelet and wavelet transform" (pages 14-27 ). If MATLAB can be used to simply practice the example of teaching materials, at least the completion of the Hal wavelet standard and non-standard procedures is quite simple. For this reason, I mainly introduce how to implement the example given to us by the instructor in MATLAB. Then, it is extended to the function implementation method using Matlab. To describe the problem easily, you must use a simhei to indicate the input part of the command window in MATLAB. If you are not familiar with the following functions and usage methods, use the help function name in the Command window, for example, help dwt2.



    3. Hal Wavelet Transform
    4. MATLAB instance

      First, we will introduce how to assign values to matrix and vector in MATLAB: input values under the> symbol of command window:

      One-dimensional vector:I= [9 7 3 5]



      F = [2, 5, 8, 9, 7, 4,-1, 1]



      Two-dimensional matrix:A = [

      64 2 3 61 60 6 7 57

      9 55 54 12 13 51 50 16

      17 47 46 20 21 43 42 24

      40 26 27 37 36 30 31 33

      32 34 35 29 28 38 39 25

      41 23 22 44 45 19 18 48

      49 15 14 52 53 11 10 56

      8 58 59 5 4 62 63 1

      ]



       

      I and F are now [Example 3.1] [Example 3.2] One-dimensional vectors, and a is the image matrix in 3.5.1. Before performing one-dimensional and two-dimensional transformations (decomposition) of Haar wavelet, we will first introduce the matrix operation of Matlab.

      MATLAB is Matrix Laboratory

      It provides first-class functions for matrix operations. Because the problem of using a matrix to describe is more like a mathematical expression, the programming is not only efficient, but also easier to read. So the MATLAB program should try to use the Matrix directly

      Description. If M is a 4x4 matrix, B = I * m completes the multiplication program using two for loops.

      After analyzing the instructor's [Example 3.1], we can get the following results:

      [(9 + 7) * 1/2 (3 + 5) * 1/2 (9-7) * 1/2 (3-5) * 1/2]

      If we regard M as a matrix-based multiplication, then let m calculate the coefficient matrix of mean and difference for its expression, then input:



      M = [

      1/2, 0, 1/2, 0

      1/2 0-1/2 0

      0 1/2 0 1/2

      0 1/2 0-1/2

      ]

      Input m to MATLAB and then use:



      C = I * m

      The result is [8, 4, 1 ].

      -1]. This is the first level decomposition coefficient of the non-normalized Haar wavelet. Note that the first two items of C [8 4] Are the approximate coefficient (approximation ).

      Coefficients), the last two items [1 _ 1] are the detail coefficients ).

      M is the non-Normalization Coefficient Matrix of Haar wavelet. If we execute:



      M * M _

      (M _ represents the transpose matrix of m), you will find that the diagonal is 0.5 and the other is 0 4x4 matrix, So if you make it into a matrix of units (the diagonal is 1 ), the original 1/2 must be increased to 1/SQRT (2), so execute:



      N = m * SQRT (2)

      Then a new coefficient matrix is obtained.

      [0.7071 0 0.7071 0

      0.7071 0-0.7071 0

      0 0.7071 0 0.7071

      0 0.7071 0-0.7071

      ]

      Run again



      N * n _

      The unit matrix is obtained. N is the Normalization Coefficient Matrix of Haar wavelet. Run the following command:



      C * M _

      The result is [4.5 3.5 1.5 2.5], apparently because the diagonal matrix value of M * M _ is 0.5. Use now



      CN = I * n

      The normalized hash factorization coefficient of one-dimensional Haar wavelet is obtained from [11.3137 5.6569 1.4142-1.4142.



      I1 = Cn * n _

      The results of inverse transformation (Reconstruction) of the normalized one-dimensional Haar wavelet [9,] are obtained. It can be seen that the benefits of the normalized matrix are that no additional operation is required for the inverse transformation, but the conversion of the normalized coefficient matrix multiplied by the factorization coefficient matrix.

      .

      If you need to perform 2nd-level decomposition on the decomposition coefficient matrix, then only the low-frequency coefficients of the first two items of C or CN are involved, the normalization and normalization matrix M1 and N1 of Haar are as follows:



      M1 = [

      1/2 1/2

      1/2

This article is transferred from

Http://kekewutao.blog.hexun.com/6504696_d.html

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.