Learn R Programming

aws (version 1.3-3.1)

awsbi: Two-dimensional Adaptive Weights Smoothing

Description

Performes two dimensional Adaptive Weigths Smoothing (depreciated version, use aws instead)

Usage

awsbi(y, lambda=3, gamma=1.3, eta =4, s2hat = NULL, kstar = length(radii),
             rmax=max(radii), radii = c((1:8)/2,4.4,5.,(6:10),(6:10)*2), 
             graph = FALSE, u0 = NULL, control="dyadic", demomode=FALSE, 
             colors=gray((0:255)/255))

Arguments

y
matrix of observed values
lambda
main smoothing parameter (should be approximately 3)
gamma
allow for increase of variances during iteration by factor gamma (!! gamma >=1)
eta
main control parameter (should be approximately 4)
s2hat
initial variance estimate (if available, can be either a number (homogeneous case), a matrix of same dimension as y (inhomogeneous variance) or NULL (a homogeneous variance estimate will be generated in this case)
kstar
maximal number of iterations to perform, actual number may be smaller depending on parameters radii and rmax
radii
radii of circular neighbourhoods used
rmax
maximal radius of neighborhood to be used, may change kstar
graph
logical, if TRUE progress (for each iteration) is illustrated grahically, if FALSE the program runs until the final estimate is obtained (much faster !!!)
u0
allows for submission of "true" values for illustration and test purposes; only if graph=TRUE, MSE and MAE are reported for each iteration step
control
the control step is performed in either a dyadic sceme ("dyadic") or using all previous estimates (otherwise)
demomode
if TRUE the function will wait for user input after each iteration; only if graph=TRUE
colors
color sceme to be used for images

Value

  • A list with components
  • yhatestimates of the regression function (matrix corresponding to the y's)
  • shatestimated standard deviations of yhat (conditional on the chosen weights)
  • numaximal number of design points in neighborhood used
  • argsmain arguments supplied to awsbi

References

Polzehl, J. and Spokoiny, V. (2000). Adaptive Weights Smoothing with applications to image restoration, J.R.Statist.Soc. B, 62, Part 2, pp. 335-354

See Also

aws, awsuni,awstri

Examples

Run this code
xy<-rbind(rep(0:255,256),rep(0:255,rep(256,256)))
indw<-c(1:12,29:48,73:100,133:168,209:256)
w0<-matrix(rep(0,256*256),ncol=256)
w0[indw,]<-1
w0[,indw]<-!w0[,indw]
w0<-w0-.5
w0[((xy[1,]-129)^2+(xy[2,]-129)^2)<=10000&((xy[1,]-129)^2+(xy[2,]-129)^2)>=4900]<- 0
w0[abs(xy[1,]-xy[2,])<=20&((xy[1,]-129)^2+(xy[2,]-129)^2)<4900]<- 0
w0[((xy[1,]-225)^2+2*(xy[2,]-30)^2)-(xy[1,]-225)*(xy[2,]-30)<=625]<- 0
w0[((xy[1,]-225)^2+2*(xy[2,]-30)^2)-(xy[1,]-225)*(xy[2,]-30)<=625&xy[2,]>27&xy[2,]<31]<- -.5
w0[((xy[1,]-225)^2+2*(xy[2,]-30)^2)-(xy[1,]-225)*(xy[2,]-30)<=625&xy[1,]>223&xy[1,]<227]<- .5
w0[((xy[2,]-225)^2+2*(xy[1,]-30)^2)+(xy[2,]-225)*(xy[1,]-30)<=625]<- 0
w0[((xy[2,]-225)^2+2*(xy[1,]-30)^2)+(xy[2,]-225)*(xy[1,]-30)<=625&xy[1,]>27&xy[1,]<31]<- -.5
w0[((xy[2,]-225)^2+2*(xy[1,]-30)^2)+(xy[2,]-225)*(xy[1,]-30)<=625&xy[2,]>223&xy[2,]<227]<- .5
w0[((xy[2,]-225)^2+(xy[1,]-225)^2)+1*(xy[2,]-225)*(xy[1,]-225)<=400]<- 0
w0[((xy[2,]-30)^2+(xy[1,]-30)^2)<=256]<-0
sigma<-.25
y<-w0+rnorm(w0,0,sigma)
#  increase rmax for better results
yhat<-awsbi(y,rmax=3)
par(mfrow=c(1,3))
image(y,col=gray((0:255)/255))
title("Noisy image")
image(yhat$yhat,zlim=range(y),col=gray((0:255)/255))
title("AWS reconstruction")
image(w0,zlim=range(y),col=gray((0:255)/255))
title("Original image")
rm(y,w0,yhat,xy)

Run the code above in your browser using DataLab