How to change the decomposition coefficients and reconstruct the image after wavelet packet decomposition?

Source: Internet
Author: User
Tags db2
Original Address:How to change the decomposition coefficients and reconstruct the image after wavelet packet decomposition. Author:Yang Storm

At present, the introduction of the Image wavelet packet transformation matlab Programming of the book is not many, but there are several, but they are a lot of MATLAB in the relevant functions of the help to re-describe it. Because the MATLAB help only shows that the decomposition results in a tree data structure, extract view is OK, how to change the decomposition coefficient is not known.

We know that the general wavelet packet decomposition is to deal with the wavelet packet coefficients, will deal with the changed coefficient reconstruction, so as to obtain the final processing results, so, how to get the coefficients, and then write the changed coefficients into the structure of the tree is the key.

The following describes how the image wavelet packet decomposition after the change of decomposition coefficients and re-reconstruction:

P=imread (' mwf1.bmp '); % Open an image

P1=double (P); % transform the image matrix into a double-precision type

WP1=WPDEC2 (p1,2, ' db2 ', ' Shannon '); % decomposition of image wavelet packets by DB2 wavelet

Nd=leaves (WP1); % get Decomposition Tree wp1 all also knot points

Cpj=wpcoef (Wp1,nd (j)); % a wavelet packet decomposition coefficient matrix corresponding to the first ND (j) node is obtained, for example j=3;

cpjn=cpj.*2; % change decomposition coefficient matrix

Wp1=write (WP1, ' CFS ', ND (j), CPJN); % will be changed after the coefficient matrix Cpjn written to the original Decomposition Tree WP1 in the structure of the second ND (j) node.

P2=WPREC2 (WP1); The modified wavelet decomposition coefficients are reconstructed, and the image is processed.

Figure (1); % display image before and after processing, compare

Subplot (211); Imagesc (P); ColorMap (' Gray ');

Subplot (212); Imagesc (Uint8 (p2)); ColorMap (' Gray ');

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.