Saturday, October 31, 2009

wavelet / short notes /1 november 2009

wavelet
short notes on wavelet
sayaNyein 25 october 2009

The MAT-files are located in the directory toolbox/wavelet/wavedemo
Wavelet toolbox-wavelet applications -wavelets in action-Illustrated examples.
History of Wavelets
From an historical point of view, wavelet analysis is a new method, though its mathematical underpinnings date back to the work of Joseph Fourier in the nineteenth century. Fourier laid the foundations with his theories of frequency analysis, which proved to be enormously important and influential.
The attention of researchers gradually turned from frequency-based analysis to scale-based analysis when it started to become clear that an approach measuring average fluctuations at different scales might prove less sensitive to noise.
The first recorded mention of what we now call a "wavelet" seems to be in 1909, in a thesis by Alfred Haar.
The concept of wavelets in its present theoretical form was first proposed by Jean Morlet and the team at the Marseille Theoretical Physics Center working under Alex Grossmann in France.
The methods of wavelet analysis have been developed mainly by Y. Meyer and his colleagues, who have ensured the methods' dissemination. The main algorithm dates back to the work of Stephane Mallat in 1988. Since then, research on wavelets has become international. Such research is particularly active in the United States, where it is spearheaded by the work of scientists such as Ingrid Daubechies, Ronald Coifman, and Victor Wickerhauser.
Barbara Burke Hubbard describes the birth, the history, and the seminal concepts in a very clear text. See "The World According to Wavelets," A.K. Peters, Wellesley, 1996.
The wavelet domain is growing up very quickly. A lot of mathematical papers and practical trials are published every moment.
Wavelet Packet Analysis
The wavelet packet method is a generalization of wavelet decomposition that offers a richer range of possibilities for signal analysis.

In wavelet analysis, a signal is split into an approximation and a detail. The approximation is then itself split into a second-level approximation and detail, and the process is repeated. For an n-level decomposition, there are n+1 possible ways to decompose or encode the signal.
In wavelet packet analysis, the details as well as the approximations can be split.
This yields more than different ways to encode the signal. This is the wavelet packet decomposition tree.
Haar
Any discussion of wavelets begins with Haar wavelet, the first and simplest. Haar wavelet is discontinuous, and resembles a step function. It represents the same wavelet as Daubechies db1. See Haar for more detail.
Daubechies
Ingrid Daubechies, one of the brightest stars in the world of wavelet research, invented what are called compactly supported orthonormal wavelets -- thus making discrete wavelet analysis practicable.
The names of the Daubechies family wavelets are written dbN, where N is the order, and db the "surname" of the wavelet. The db1 wavelet, as mentioned above, is the same as Haar wavelet. Here are the wavelet functions psi of the next nine members of the family:
Biorthogonal
This family of wavelets exhibits the property of linear phase, which is needed for signal and image reconstruction. By using two wavelets, one for decomposition (on the left side) and the other for reconstruction (on the right side) instead of the same single one, interesting properties are derived.
Wavelet Analysis
Wavelet analysis represents the next logical step: a windowing technique with variable-sized regions. Wavelet analysis allows the use of long time intervals where we want more precise low-frequency information, and shorter regions where we want high-frequency information
--------
You may have noticed that wavelet analysis does not use a time-frequency region, but rather a time-scale region. For more information about the concept of scale and the link between scale and frequency, see How to Connect Scale to Frequency?.

What Can Wavelet Analysis Do?
One major advantage afforded by wavelets is the ability to perform local analysis -- that is, to analyze a localized area of a larger signal.
Consider a sinusoidal signal with a small discontinuity -- one so tiny as to be barely visible. Such a signal easily could be generated in the real world, perhaps by a power fluctuation or a noisy switch.
Wavelet analysis is capable of revealing aspects of data that other signal analysis techniques miss, aspects like trends, breakdown points, discontinuities in higher derivatives, and self-similarity. Furthermore, because it affords a different view of data than those presented by traditional techniques, wavelet analysis can often compress or de-noise a signal without appreciable degradation.
What Is Wavelet Analysis?
Now that we know some situations when wavelet analysis is useful, it is worthwhile asking "What is wavelet analysis?" and even more fundamentally, "What is a wavelet?"
A wavelet is a waveform of effectively limited duration that has an average value of zero.
Compare wavelets with sine waves, which are the basis of Fourier analysis. Sinusoids do not have limited duration -- they extend from minus to plus infinity. And where sinusoids are smooth and predictable, wavelets tend to be irregular and asymmetric.
Fourier analysis consists of breaking up a signal into sine waves of various frequencies. Similarly, wavelet analysis is the breaking up of a signal into shifted and scaled versions of the original (or mother) wavelet.
Just looking at pictures of wavelets and sine waves, you can see intuitively that signals with sharp changes might be better analyzed with an irregular wavelet than with a smooth sinusoid, just as some foods are better handled with a fork than a spoon.
It also makes sense that local features can be described better with wavelets that have local extent.
Number of Dimensions

Thus far, we've discussed only one-dimensional data, which encompasses most ordinary signals. However, wavelet analysis can be applied to two-dimensional data (images) and, in principle, to higher dimensional data.
This toolbox uses only one- and two-dimensional analysis techniques.
The Discrete Wavelet Transform
Calculating wavelet coefficients at every possible scale is a fair amount of work, and it generates an awful lot of data. What if we choose only a subset of scales and positions at which to make our calculations?
It turns out, rather remarkably, that if we choose scales and positions based on powers of two -- so-called dyadic scales and positions -- then our analysis will be much more efficient and just as accurate. We obtain such an analysis from the discrete wavelet transform (DWT). For more information on DWT, see Algorithms.
An efficient way to implement this scheme using filters was developed in 1988 by Mallat (see [Mal89] in References). The Mallat algorithm is in fact a classical scheme known in the signal processing community as a two-channel subband coder (see page 1 of the book Wavelets and Filter Banks, by Strang and Nguyen [StrN96]).
This very practical filtering algorithm yields a fast wavelet transform -- a box into which a signal passes, and out of which wavelet coefficients quickly emerge. Let's examine this in more depth.
Nuance fine distinction, trace, tinge.
One-Stage Filtering: Approximations and Details
For many signals, the low-frequency content is the most important part. It is what gives the signal its identity. The high-frequency content, on the other hand, imparts flavor or nuance. Consider the human voice. If you remove the high-frequency components, the voice sounds different, but you can still tell what's being said. However, if you remove enough of the low-frequency components, you hear gibberish.
In wavelet analysis, we often speak of approximations and details. The approximations are the high-scale, low-frequency components of the signal. The details are the low-scale, high-frequency components.
The filtering process, at its most basic level, looks like this---

the original signal, S, passes through two complementary filters and emerges as two signals.
Unfortunately, if we actually perform this operation on a real digital signal, we wind up with twice as much data as we started with. Suppose, for instance, that the original signal S consists of 1000 samples of data. Then the resulting signals will each have 1000 samples, for a total of 2000.
These signals A and D are interesting, but we get 2000 values instead of the 1000 we had. There exists a more subtle way to perform the decomposition using wavelets. By looking carefully at the computation, we may keep only one point out of two in each of the two 2000-length samples to get the complete information. This is the notion of downsampling. We produce two sequences called cA and cD.
The process on the right, which includes downsampling, produces DWT coefficients.
To gain a better appreciation of this process, let's perform a one-stage discrete wavelet transform of a signal. Our signal will be a pure sinusoid with high-frequency noise added to it.
Here is our schematic diagram with real signals inserted into it.
The MATLAB code needed to generate s, cD, and cA is
s = sin(20.*linspace(0,pi,1000)) + 0.5.*rand(1,1000);
[cA,cD] = dwt(s,'db2');
where db2 is the name of the wavelet we want to use for the analysis.
Notice that the detail coefficients cD are small and consist mainly of a high-frequency noise, while the approximation coefficients cA contain much less noise than does the original signal.
[length(cA) length(cD)]
ans =
501 501
You may observe that the actual lengths of the detail and approximation coefficient vectors are slightly more than half the length of the original signal. This has to do with the filtering process, which is implemented by convolving the signal with a filter. The convolution "smears" the signal, introducing several extra samples into the result.
%The MATLAB code needed to generate s, cD, and cA is
s = sin(20.*linspace(0,pi,1000)) + 0.5.*rand(1,1000);

[cA,cD] = dwt(s,'db2');
Wavelet Toolbox
Introduction to Wavelet Analysis
Each example is followed by a discussion of the usefulness of wavelet analysis for the particular application area under consideration.
Use the graphical interface tools to follow along: From the MATLAB command line, type
wavemenu
Click on Wavelets 1-D (or another tool as appropriate). Load the sample analysis by selecting the appropriate submenu item from FileExample Analysis.
Feel free to explore on your own -- use the different options provided in the graphical interface to look at different components of the signal, to compress or de-noise the signal, to examine signal statistics, or to zoom in and out on different signal features.
If you want, try loading the corresponding MAT-file from the MATLAB command line, and use the Wavelet Toolbox functions to further investigate the sample signals. The MAT-files are located in the directory toolbox/wavelet/wavedemo.
There are also other signals in the wavedemo directory that you can analyze on your own.
Detecting Discontinuities and Breakdown Points I
The purpose of this example is to show how analysis by wavelets can detect the exact instant when a signal changes. The discontinuous signal consists of a slow sine wave abruptly followed by a medium sine wave.
The first- and second-level details (D1 and D2) show the discontinuity most clearly, because the rupture contains the high-frequency part. Note that if we were only interested in identifying the discontinuity, db1 would be a more useful wavelet to use for the analysis than db5.
The discontinuity is localized very precisely: only a small domain around time = 500 contains any large first- or second-level details.
Here is a noteworthy example of an important advantage of wavelet analysis over Fourier. If the same signal had been analyzed by the Fourier transform, we

would not have been able to detect the instant when the signal's frequency changed, whereas it is clearly observable here.
Details D3 and D4 contain the medium sine wave. The slow sine is clearly isolated in approximation A5, from which the higher-frequency information has been filtered.
Discussion
The deterministic part of the signal may undergo abrupt changes such as a jump, or a sharp change in the first or second derivative. In image processing, one of the major problems is edge detection, which also involves detecting abrupt changes. Also in this category, we find signals with very rapid evolutions such as transient signals in dynamic systems.
The main characteristic of these phenomena is that the change is localized in time or in space.
The purpose of the analysis is to determine
The site of the change (e.g., time or position)
The type of change (a rupture of the signal, or an abrupt change in its first or second derivative)
The amplitude of the change
The local aspects of wavelet analysis are well adapted for processing this type of event, as the processing scales are linked to the speed of the change.
Guidelines for Detecting Discontinuities
Short wavelets are often more effective than long ones in detecting a signal rupture. In the initial analysis scales, the support is small enough to allow fine analysis. The shapes of discontinuities that can be identified by the smallest wavelets are simpler than those that can be identified by the longest wavelets. Therefore, to identify A signal discontinuity, use the haar wavelet A rupture in the j-th derivative, select a sufficiently regular wavelet with at least j vanishing moments. (See Detecting Discontinuities and Breakdown Points II.)
The presence of noise, which is after all a fairly common situation in signal processing, makes identification of discontinuities more complicated. If the first levels of the decomposition can be used to eliminate a large part of the noise, the rupture is sometimes visible at deeper levels in the decomposition.
Check, for example, the sample analysis FileExample AnalysisBasic Signalsramp + white noise (MAT-file wnoislop). The rupture is visible in the level-six approximation (A6) of this signal.

Detecting Discontinuities and Breakdown Points II
The purpose of this example is to show how analysis by wavelets can detect a discontinuity in one of a signal's derivatives. The signal, while apparently a single smooth curve, is actually composed of two separate exponentials that are connected at time = 500. The discontinuity occurs only in the second derivative, at time = 500.
**********************
We have zoomed in on the middle part of the signal to show more clearly what happens around time = 500. The details are high only in the middle of the signal and are negligible elsewhere. This suggests the presence of high-frequency information -- a sudden change or discontinuity -- around time = 500.
Discussion
Regularity can be an important criterion in selecting a wavelet. We have chosen to use db4, which is sufficiently regular for this analysis. Had we chosen the haar wavelet, the discontinuity would not have been detected. If you try repeating this analysis using haar at level two, you'll notice that the details are equal to zero at time = 500.
Note that to detect a singularity, the selected wavelet must be sufficiently regular, which implies a longer filter impulse response.
See the sections Frequently Asked Questions and Wavelet Families: Additional Discussion for a discussion of the mathematical meaning of regularity and a comparison of the regularity of various wavelets.
Detecting Long-Term Evolution
The purpose of this example is to show how analysis by wavelets can detect the overall trend of a signal. The signal in this case is a ramp obscured by "colored" (limited-spectrum) noise. (We have zoomed in along the x-axis to avoid showing edge effects.)
There is so much noise in the original signal, s, that its overall shape is not apparent upon visual inspection. In this level-6 analysis, we note that the trend becomes more and more clear with each approximation, A1 to A6. Why is this?

The trend represents the slowest part of the signal. In wavelet analysis terms, this corresponds to the greatest scale value. As the scale increases, the resolution decreases, producing a better estimate of the unknown trend.
Another way to think of this is in terms of frequency. Successive approximations possess progressively less high-frequency information. With the higher frequencies removed, what's left is the overall trend of the signal.
Discussion
Wavelet analysis is useful in revealing signal trends, a goal that is complementary to the one of revealing a signal hidden in noise. It's important to remember that the trend is the slowest part of the signal. If the signal itself includes sharp changes, then successive approximations look less and less similar to the original signal.
Consider the demo analysis FileExample AnalysisBasic SignalsStep signal (MAT-file wstep.mat). It is instructive to analyze this signal using the Wavelet 1-D tool and see what happens to the successive approximations. Try it.
Detecting Self-Similarity
The purpose of this example is to show how analysis by wavelets can detect a self-similar, or fractal, signal. The signal here is the Koch curve -- a synthetic signal that is built recursively.
This analysis was performed with the Continuous Wavelet 1-D graphical tool. A repeating pattern in the wavelet coefficients plot is characteristic of a signal that looks similar on many scales.
Wavelet Coefficients and Self-Similarity
From an intuitive point of view, the wavelet decomposition consists of calculating a "resemblance index" between the signal and the wavelet. If the index is large, the resemblance is strong, otherwise it is slight. The indices are the wavelet coefficients.
If a signal is similar to itself at different scales, then the "resemblance index" or wavelet coefficients also will be similar at different scales. In the coefficients plot, which shows scale on the vertical axis, this self-similarity generates a characteristic pattern.
Discussion
The work of many authors and the trials that they have carried out suggest that wavelet decomposition is very well adapted to the study of the fractal properties of signals and images.

When the characteristics of a fractal evolve with time and become local, the signal is called a multifractal. The wavelets then are an especially suitable tool for practical analysis and generation.
Wednesday, March 25, 2009
Example 14: A Real Electricity Consumption Signal
Analyzing wavelet: db3
Decomposition levels: 5
The series presents a peak in the center, followed by two drops, a shallow drop, and then a considerably weaker peak.
The details for levels 1 and 2 are of the same order of magnitude and give a good expression of the local irregularities caused by the noise. The detail for level 3 presents high values in the beginning and at the end of the main peak, thus allowing us to locate the corresponding drops. The detail D4 shows coarser morphological aspects for the series (i.e., three successive peaks). This fits the shape of the curve remarkably well, and includes the essential signal components for periods of less than 32 time-units. The approximations show this effect clearly: A1 and A2 bear a strong resemblance; A3 forms a reasonably accurate approximation of the original signal. A look at A4, however, shows that a considerable amount of information has been lost.
In this case, as a conclusion, the multiscale aspect is the most interesting and the most significant feature: the essential components of the electrical signal used to complete the description at 32 time-units (homogeneous to A5) are the components with a period between 8 and 16 time-units.
Example 1: A Sum of Sines
Analyzing wavelet: db3
Decomposition levels: 5
The signal is composed of the sum of three sines: slow, medium, and rapid. With regard to the sampling period equal to 1, the periods are approximately 200, 20, and 2 respectively. We should, therefore, see this later period in D1, the medium sine in D4, and the slow sine in A4. The slight differences that can be observed on the decompositions can be attributed to the sampling period. The scale of the approximation charts is 2, 4, or 10 times larger than that of the details. D1 contains

primarily the components whose period is situated between 1 and 2 (i.e., the rapid sine), but this period is not visible at the scale that is used for the graph. Zooming in on D1 reveals that each "belly" is composed of 10 oscillations, and can be used to estimate the period. We find that the period is close to 2. D2 is very small. This is also seen in the approximations: the first two resemble one another, since .
The detail D3 and, to an even greater extent, the detail D4 contain the medium sine. We notice that there is a breakdown between approximations 3 and 4.
Approximations A1 to A3 can be used to estimate the period of the medium sine. Now, only the slow sine, which appears in A4, remains to be determined. The distance between two successive maximums is equal to 200, which is the period of the slow sine. This latter sine is still visible in A5, but will disappear from the approximation and move into the details at level 8.
Example 2: A Frequency Breakdown
Analyzing wavelet: db5
Decomposition levels: 5
The signal is formed of a slow sine and a medium sine, on either side of 500. These two sines are not connected in a continuous manner: D1 and D2 can be used to detect this discontinuity. It is localized very precisely: only a small domain around 500 contains large details. This is because the rupture contains the high-frequency part; the frequencies in the rest of the signal are not as high. It should be noted that if we are interested only in identifying the discontinuity, db1 is more useful than db5.
D3 and D4 contain the medium sine as in the previous analysis. The slow sine appears clearly alone in A5. It is more regular than in the s1 analysis, since db5 is more regular than db3. If the same signal had been analyzed by the Fourier transform, we would not have been able to detect the instant corresponding to the signal's frequency change, whereas it is clearly observable here.
Example 3: Uniform White Noise
Analyzing wavelet: db3
Decomposition levels: 5
At all levels we encounter noise-type signals that are clearly irregular. This is because all the frequencies carry the same energy. The variances, however, decrease regularly between one level and the next as can be seen reading the detail chart (on the right) and the approximations (on the left).
The variance decreases two-fold between one level and the next, i.e., variance(Dj) = variance(Dj - 1) / 2. Lastly, it should be noted that the details and approximations are not white noise, and that these signals are increasingly interdependent as the

resolution decreases. On the other hand, the wavelet coefficients are random, noncorrelated variables. This property is not evident on the reconstructed signals shown here, but it can be guessed at from the representation of the coefficients.
Wavelet toolbox-wavelet applications -wavelets in action-Illustrated examples.
Example 1: A Sum of Sines
Analyzing wavelet: db3
Decomposition levels: 5
The signal is composed of the sum of three sines: slow, medium, and rapid. With regard to the sampling period equal to 1, the periods are approximately 200, 20, and 2 respectively. We should, therefore, see this later period in D1, the medium sine in D4, and the slow sine in A4. The slight differences that can be observed on the decompositions can be attributed to the sampling period. The scale of the approximation charts is 2, 4, or 10 times larger than that of the details. D1 contains primarily the components whose period is situated between 1 and 2 (i.e., the rapid sine), but this period is not visible at the scale that is used for the graph. Zooming in on D1 reveals that each "belly" is composed of 10 oscillations, and can be used to estimate the period. We find that the period is close to 2. D2 is very small. This is also seen in the approximations: A1=A2+D2.
the first two resemble one another, since .
The detail D3 and, to an even greater extent, the detail D4 contain the medium sine. We notice that there is a breakdown between approximations 3 and 4.
Approximations A1 to A3 can be used to estimate the period of the medium sine. Now, only the slow sine, which appears in A4, remains to be determined. The distance between two successive maximums is equal to 200, which is the period of the slow sine. This latter sine is still visible in A5, but will disappear from the approximation and move into the details at level 8.
Wavelet toolbox-wavelet applications -wavelets in action-Illustrated examples.
Example 2: A Frequency Breakdown
Analyzing wavelet: db5
Decomposition levels: 5
The signal is formed of a slow sine and a medium sine, on either side of 500. These two sines are not connected in a continuous manner: D1 and D2 can be used to detect this discontinuity. It is localized very precisely: only a small domain around 500 contains large details. This is because the rupture contains the high-frequency part; the frequencies in the rest of the signal are not as high. It should be noted that if we are interested only in identifying the discontinuity, db1 is more useful than db5.
D3 and D4 contain the medium sine as in the previous analysis. The slow sine appears clearly alone in A5. It is more regular than in the s1 analysis, since db5 is more regular than db3. If the same signal had been analyzed by the Fourier

Transform, we would not have been able to detect the instant corresponding to the signal's frequency change, whereas it is clearly observable here.
Wavelet toolbox-wavelet applications -wavelets in action-Illustrated examples.
Example 3: Uniform White Noise
Analyzing wavelet: db3
Decomposition levels: 5
At all levels we encounter noise-type signals that are clearly irregular. This is because all the frequencies carry the same energy. The variances, however, decrease regularly between one level and the next as can be seen reading the detail chart (on the right) and the approximations (on the left).
The variance decreases two-fold between one level and the next, i.e., variance(Dj) = variance(Dj - 1) / 2. Lastly, it should be noted that the details and approximations are not white noise, and that these signals are increasingly interdependent as the resolution decreases. On the other hand, the wavelet coefficients are random, noncorrelated variables. This property is not evident on the reconstructed signals shown here, but it can be guessed at from the representation of the coefficients.
Wavelet toolbox-wavelet applications -wavelets in action-Illustrated examples.
Example 6: A Step Signal
Analyzing wavelet: db2
Decomposition levels: 5
In this case, we are faced with the simplest example of a rupture (i.e., a step). The time instant when the jump occurs is equal to 500. The break is detected at all levels, but it is obviously detected with greater precision in the higher resolutions (levels 1 and 2) than in the lower ones (levels 4 and 5). It is very precisely localized at level 1, where only a very small zone around the jump time can be seen.
It should be noted that the reconstructed details are primarily composed of the basic wavelet represented in the initial time.
Furthermore, the rupture is more precisely localized when the wavelet corresponds to a short filter.
Wavelet toolbox-wavelet applications -wavelets in action-Illustrated examples.
Wednesday, March 25, 2009
Example 7: Two Proximal Discontinuities
Analyzing wavelet: db2 and db7
Decomposition levels: 5
The signal is formed of two straight lines with identical slopes, extending across a very short plateau. On the initial signal, the plateau is in fact barely visible to the naked eye. Two analyses are thus carried out: one on a well localized wavelet with the short filter (db2, shown on the left side of the figure); and the other on a wavelet having a longer filter (db7, shown on the right side of the figure).

In both analyses, the plateau is detected clearly. With the exception of a fairly limited domain, D1 is equal to zero. The regularity of the signal in the plateau, however, is clearly distinguished for db2 (for which plateau beginning and end time are distinguished), whereas for db7 both discontinuities are fused and only the entire plateau can be said to be visible.
This example suggests that the selected wavelets should be associated with short filters to distinguish proximal discontinuities of the first derivative. A look at the other detail levels again shows the lack of precision when detecting at low resolutions. The wavelet filters the straight line and analyzes the discontinuities.
Wednesday, March 25, 2009
Example 8: A Second-Derivative Discontinuity
Analyzing wavelet: db1 and db4
Decomposition levels: 2
This figure shows that the regularity can be an important criterion in selecting a wavelet. The basic function is composed of two exponentials that are connected at 0, and the analyzed signal is the sampling of the continuous function with increments of 10-3. The sampled signal is analyzed using two different wavelets: db1, which is insufficiently regular (shown on the left side of the figure); and db4, which is sufficiently regular (shown on the right side of the figure).
Looking at the figure on the left we notice that the singularity has not been detected in the extent that the details are equal to 0 at 0. The black areas correspond to very rapid oscillations of the details. These values are equal to the difference between the function and an approximation using a constant function. Close to 0, the slow decrease of the details absolute values followed by a slow increase is due to the fact that the function derivative is zero and continuous at 0. The value of the details is very small (close to 10-3 for db1 and 10-4 for db4) since the signal is very smooth and does not contain any high frequency. This value is even smaller for db4, since the wavelet is more regular than db1.
However, with db4 (right side of the figure), the discontinuity is well detected: the details are high only close to 0, and are 0 everywhere else. This is the only element that can be derived from the analysis. In this case, as a conclusion, we notice that the selected wavelet must be sufficiently regular, which implies a longer filter impulse response to detect the singularity.
Example 9: A Ramp + White Noise
Analyzing wavelet: db3
Decomposition levels: 6

The signal is built from a trend plus noise. The trend is a slow linear rise from 0 to 3, up to t=500, and becoming constant afterwards. The noise is a uniform zero-mean white noise, varying between -0.5 and 0.5 (see the analyzed signal b1).
Looking at the figure, in the chart on the right, we again find the decomposition of noise in the details. In the charts on the left, the approximations form increasingly precise estimates of the ramp with less and less noise. These approximations are quite acceptable from level 3, and the ramp is well reconstructed at level 6.
We can, therefore, separate the ramp from the noise. Although the noise affects all scales, its effect decreases sufficiently quickly for the low-resolution approximations to restore the ramp. It should also be noted that the breakdown point of the ramp is shown with good precision. This is due to the fact that the ramp is recovered at too low a resolution.
The uniform noise indicates that the ramp might be best estimated using half sums for the higher and lower portions of the signal. This approach is not applicable for other noises.
xample 10: A Ramp + Colored Noise
Analyzing wavelet: db3
Decomposition levels: 6
The signal is built in the same manner as in Example 9: A Ramp + White Noise, using a trend plus a noise. The trend is a slow linear increase from 0 to 1, up to t=500. Beyond this time, the value remains constant. The noise is a zero mean AR(3) noise, varying between -3 and 3 (see the analyzed signal b2). The scale of the noise is indeed six times greater than that of the ramp. At first glance, the situation seems a little bit less favorable than in the previous example, in terms of the separation between the ramp and the noise. This is actually a misconception, since the two signal components are more precisely separated in frequency.
Looking at the figure, the charts on the right show the detail decomposition of the colored noise. The charts on the left show a decomposition that resembles the one in the previous analysis. Starting at level 3, the curves provide satisfactory approximations of the ramp.
%is this creation
%Example
I = imread('eight.tif');
J = imnoise(I,'salt & pepper',0.02);
imshow(I)
%figure, imshow(J)
%'gaussian' %Gaussian white noise with constant mean and variance
%'localvar' %Zero-mean Gaussian white noise with an intensity-dependent variance
%'poisson' %Poisson noise
%'salt & pepper' %On and off pixels
%'speckle' %Multiplicative noise.
Thursday, April 02, 2009
To contd.Wavelet toolbox-Advanced concepts-general concepts
General Concepts

This section presents a brief overview of wavelet concepts, focusing mainly on the orthogonal wavelet case. It includes the following sections: Wavelets: A New Tool for Signal Analysis Wavelet Decomposition: A Hierarchical Organization
Finer and Coarser Resolutions
Wavelet Shapes Wavelets and Associated Families
Wavelet Transforms:
Continuous and Discrete
Local and Global Analysis Synthesis:
An Inverse Transform Details and Approximations.
Wavelet Toolbox
Wavelets: A New Tool for Signal Analysis
Wavelet analysis consists of decomposing a signal or an image into a hierarchical set of approximations and details. The levels in the hierarchy often correspond to those in a dyadic scale.
From the signal analyst's point of view, wavelet analysis is a decomposition of the signal on a family of analyzing signals, which is usually an "orthogonal function method.
From an algorithmic point of view, wavelet analysis offers a harmonious compromise between decomposition and smoothing techniques.
Wavelet Toolbox
Wavelet Decomposition: A Hierarchical Organization
Unlike conventional techniques, wavelet decomposition produces a family of hierarchically organized decompositions. The selection of a suitable level for the hierarchy will depend on the signal and experience. Often the level is chosen based on a desired low-pass cutoff frequency.
At each level j, we build the j-level approximation Aj, or approximation at level j, and a deviation signal called the j-level detail Dj, or detail at level j. We can consider the original signal as the approximation at level 0, denoted by A0. The words approximation and detail are justified by the fact that A1 is an approximation of A0 taking into account the low frequencies of A0, whereas the detail D1 corresponds to the high frequency correction. Among the figures presented in the section Reconstructing Approximations and Details, one of them graphically represents this hierarchical decomposition.
One way of understanding this decomposition consists of using an optical comparison. Successive images A1, A2, A3 of a given object are built. We use the same type of photographic devices, but with increasingly poor resolution. The images are successive approximations; one detail is the discrepancy between two

successive images. Image A2 is, therefore, the sum of image A4 and intermediate details D4, D3.
A2=A3+D3=A4+D4+D3.
Wavelet Toolbox
Finer and Coarser Resolutions
The organizing parameter, the scale a, is related to level j by a = 2^j . If we define resolution as 1/a, then the resolution increases as the scale decreases. The greater the resolution, the smaller and finer are the details that can be accessed.
j 10 9... 2 1 0 -1 -2
Scale 1024 512... 4 2 1 ½ 1/4
Resolution 1/2^10 ½^9...1/4 1/2 1 2 4
From a technical point of view, the size of the revealed details for any j is proportional to the size of the domain in which the wavelet or analyzing function of the variable x,
Xi(x/a)
is not too close to 0.
To continue-wavelet shapesThursday, April 02, 2009
Wavelet Toolbox
Wavelet Shapes
One-dimensional analysis is based on one scaling function Fi and one wavelet Zi . Two-dimensional analysis (on a square or rectangular grid) is based on one scaling function Fi(x1,x2) and three wavelets.
The following figure shows Fi and Zi for each wavelet, except the Morlet wavelet and the Mexican hat, for which Fi does not exist. All the functions decay quickly to zero. The Haar wavelet is the only noncontinuous function with three points of discontinuity (0, 0.5, 1). The Fi functions oscillate more than associated Zi functions. coif2 exhibits some angular points; db6 and sym6 are quite smooth. The Morlet and Mexican hat wavelets are symmetrical.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Wavelet Toolbox
Wavelets and Associated Families
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Wavelet Toolbox
Wavelet Transforms: Continuous and Discrete

The wavelet transform of a signal s is the family C(a,b), which depends on two indices a and b. The set to which a and b belong is given below in the table. The studies focus on two transforms: Continuous transform Discrete transform
From an intuitive point of view, the wavelet decomposition consists of calculating a "resemblance index" between the signal and the wavelet located at position b and of scale a. If the index is large, the resemblance is strong, otherwise it is slight. The indexes C(a,b) are called coefficients.
We define the coefficients in the following table. We have two types of analysis at our disposal
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Using a redundant representation close to the so-called continuous analysis, instead of a nonredundant discrete time-scale representation, can be useful for analysis purposes. The nonredundant representation is associated with an orthonormal basis, whereas the redundant representation uses much more scale and position values than a basis. For a classical fractal signal, the redundant methods are quite accurate.
Graphic representation of discrete analysis: (in the middle of Figure 6-6, Continuous Versus Discrete Transform) time is on the abscissa and on the ordinate the scale a is dyadic: 21, 22, 23, 24, and 25 (from the bottom to the top), levels are 1, 2, 3, 4, and 5. Each coefficient of level k is repeated 2k times.
Graphic representation of continuous analysis: (at the bottom of Figure 6-6, Continuous Versus Discrete Transform) time is on the abscissa and on the ordinate the scale varies almost continuously between 21 and 25 by step 1 (from the bottom to the top). Keep in mind that when a scale is small, only small details are analyzed, as in a geographical map.
Wednesday, April 08, 2009 6:08 AM
To continue-Wavelets-Advanced concepts-general concepts-
Wavelet Toolbox
Dealing with Border Distortion
Classically, the DWT is defined for sequences with length of some power of 2, and different ways of extending samples of other sizes are needed. Methods for extending the signal include zero-padding, smooth padding, periodic extension, and boundary value replication (symmetrization).
The basic algorithm for the DWT is not limited to dyadic length and is based on a simple scheme: convolution and downsampling. As usual, when a convolution is performed on finite-length signals, border distortions arise.
%%%%%%%%%%%%%%%
Basic two-dimensional objects.
A0 Approximation at level 0
Approximation at level k

Dk Details at level k
cAk, Approximation coefficients at level k
cDk Detail coefficients at level k
the horizontal, vertical, and diagonal details at level k.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Two-Dimensional Analysis Using the Command Line
Note Instead of directly using image(I) to visualize the image I, we use image(wcodemat(I)), which displays a rescaled version of I leading to a clearer presentation of the details and approximations (see wcodemat reference page)
$$$$$$$$$$$$$$$
To continue Two-dimensional analysis using the command line.
Tuesday, April 14, 2009
% Two primal liftings starting from the Haar wavelet
% 14 april 09
%Example 2: . Two primal liftings starting from the Haar wavelet
% Get Haar filters.
[LoD,HiD,LoR,HiR] = wfilters('haar');
% Lift the Haar filters.
twoels(1) = struct('type','p','value',...
laurpoly([0.125 -0.125],0));
twoels(2) = struct('type','p','value',...
laurpoly([0.125 -0.125],1));
[LoDN,HiDN,LoRN,HiRN] = liftfilt(LoD,HiD,LoR,HiR,twoels);
% The biorthogonal wavelet bior1.3 is obtained up to
% an unsignificant sign.
[LoDB,HiDB,LoRB,HiRB] = wfilters('bior1.3');
samewavelet =isequal([LoDB,HiDB,LoRB,HiRB],[LoDN,-HiDN,LoRN,HiRN])
%samewavelet =
% 1
% Visualize the two times two pairs of scaling and wavelet
% functions.
bswfun(LoDN,HiDN,LoRN,HiRN,'plot');
%all correct
To continue ---lifting functions
(25 december 2008).

No comments: