inpainting: image recovery using Lasso regression

View source: R/models.R

inpaintingR Documentation

image recovery using Lasso regression

Description

predicts the missing pixels in an image using Lasso regression and fills the hole in the image

Usage

inpainting(image,h,stride,i,j,width,height,lambda=0.1,max_iter=50000,
fista=TRUE, verbose=TRUE,ini=0,glmnet=TRUE,noise=TRUE)

Arguments

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

Details

inpainting

Value

a 3D array with the hole filled by pixels predicted by Lasso regression

Examples

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")

ProxReg documentation built on April 3, 2025, 9:21 p.m.