inpainting | R Documentation |
predicts the missing pixels in an image using Lasso regression and fills the hole in the image
inpainting(image,h,stride,i,j,width,height,lambda=0.1,max_iter=50000,
fista=TRUE, verbose=TRUE,ini=0,glmnet=TRUE,noise=TRUE)
image |
image to be modified, it has to be a 3D array proceed with readImage function from EBImage package |
h |
size of the patch |
stride |
stride for the patch |
i |
row index of the upper left corner of the rectangle |
j |
column index of the upper left corner of the rectangle |
width |
width of the rectangle |
height |
height of the rectangle |
lambda |
a penalized parameter for the Lasso regression, it is 0.1 by default |
max_iter |
maximum number of iterations, it is 50000 by default |
fista |
fista=TRUE: use FISTA algortihm for the pixel prediction |
verbose |
print the iteration number and the size of the boundary |
ini |
initial value for the coefficients, default is 0 |
glmnet |
use glmnet package for the Lasso regression |
noise |
display the image with the hole, it is TRUE by default |
inpainting
a 3D array with the hole filled by pixels predicted by Lasso regression
test_img <- EBImage::readImage(system.file("extdata", "bird.jpg", package = "ProxReg"))
image_repaired <- inpainting(
test_img, h = 10, stride = 6, i = 160, j = 160, width = 20, height = 20,
lambda = 0.001, max_iter = 1000, verbose = TRUE, glmnet = TRUE,noise=TRUE)
RGB_repaired<-EBImage::Image(image_repaired,colormode = "Color")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.