inpaint: Use a given dictionary D to inpaint image

Description Usage Arguments Value Examples

View source: R/Inpaint.R

Description

Given D, obtain the sparse coding A_hat in Y=DA. Then Y_inpaint=DA_hat. See https://arxiv.org/abs/1605.07870

Usage

1
inpaint(Y, Mask, D, L = 30, eps = NULL, sigma = 0)

Arguments

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.

Value

The inpainted matrix Y.

Examples

 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)

GSCAD documentation built on Oct. 6, 2017, 5:04 p.m.

Related to inpaint in GSCAD...