imager (version 0.41.2)

inpaint: Fill-in NA values in an image

Description

Fill in NA values (inpainting) using a Gaussian filter, i.e. replace missing pixel values with a weighted average of the neighbours.

Usage

inpaint(im, sigma)

Arguments

im

input image

sigma

std. deviation of the Gaussian (size of neighbourhood)

Value

an image with missing values filled-in.

Examples

Run this code
# NOT RUN {
im <- boats
im[sample(nPix(im),1e4)] <- NA
inpaint(im,1) %>% imlist(im,.) %>%
   setNames(c("before","after")) %>% plot(layout="row")
# }

Run the code above in your browser using DataCamp Workspace