Description Usage Arguments Value Examples
Given D, obtain the sparse coding A_hat in Y=DA. Then Y_inpaint=DA_hat. See https://arxiv.org/abs/1605.07870
1 |
Y |
Each column of Y is a vectorized image patch to be denoised. |
Mask |
0,1 matrix of the same size as Y to indicate the location of corrupted pixels. |
D |
D is the dictionary used in Y=DA to inpaint. |
L |
(optional) This parameter controls the maximum number of non-zero elements in each column of sparsecolding A. |
eps |
(optional) A lasso tuning paramter |
sigma |
Noise level. |
The inpainted matrix Y.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | I=lena_crop
## corrupt 30% of the image
out_corrupt=AddHoles(I,0.3)
I_corrupt=out_corrupt$corruptedImage
I_mask=out_corrupt$maskImage
## split image
m=64
Y_nc = ImageSplit(I_corrupt,sqrt(m),sqrt(m));
M = ImageSplit(I_mask,sqrt(m),sqrt(m));
mu=colSums(Y_nc*M)/colSums(M)
Y=Y_nc-M*rep(mu,each=nrow(Y_nc))
mask = matrix(as.logical(M),ncol=ncol(M))
## use ODCT dictionary
D0=ODCT(64,100)
## inpaint
Y_inpaint=inpaint(Y,mask,D0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.