Library: | wavelet |
See also: | dwt invdwt stein hardthres softthres sure |
Quantlet: | sure2d | |
Description: | Sure denoises wavelet coefficients. If the stein procedure is chosen, the mean squared error is minimized. MSE is estimated by Stein's unbiased risk estimator based on the variance of the coefficients. Sure computes then the optimal threshold for the father wavelets and each level of mother wavelets. If soft or hard thresholding is chosen, only the mother wavelet coefficients will be denoised. |
Usage: | datt = sure2d (dat,l,pro) | |
Input: | ||
dat | n x n array, wavelet coefficients | |
l | integer, l^2 is the number of the father wavelet coefficients | |
pro | string, "stein","soft" or "hard" indicating the chosen wished method | |
Output: | ||
datt | n x n array, thresholded wavelet coefficients |
; loads the library wavelet library("wavelet") n = 32 x = grid(0|0,(1./n)|(1./n), n|n ) ; computes a noisy step function y = 0.1*(x[,1].<=0.4) + 2*(abs(x[,1]-0.5).<0.1) y = y + 0.5*(abs(x[,1]- 0.7)<0.1) y = y + 2* x[,2]^2 y = y + normal(n^2) *0.5 y = reshape(y,n|n) ; computes the wavelet coefficients coeff = fwt2(y, 2, daubechies2,10) ; thresholds the coefficients coefft = sure2d(coeff, 2,"stein") ; computes the inverse wavelet transform ys = invfwt2(coefft, 2, daubechies2,10) d = createdisplay(1,1) tdat = x~vec(ys) setmaskp(tdat, 4, 4, 8) show(d,1,1, tdat, x~vec(y))
ys denoised estimate of y