image_expand: Expands an image

View source: R/utils_imagem.R

image_expandR Documentation

Expands an image

Description

Expands an image towards the left, top, right, or bottom by sampling pixels from the image edge. Users can choose how many pixels (rows or columns) are sampled and how many pixels the expansion will have.

Usage

image_expand(
  img,
  left = NULL,
  top = NULL,
  right = NULL,
  bottom = NULL,
  edge = NULL,
  sample_left = 10,
  sample_top = 10,
  sample_right = 10,
  sample_bottom = 10,
  random = FALSE,
  filter = NULL,
  plot = TRUE
)

Arguments

img

An Image object.

left, top, right, bottom

The number of pixels to expand in the left, top, right, and bottom directions, respectively.

edge

The number of pixels to expand in all directions. This can be used to avoid calling all the above arguments

sample_left, sample_top, sample_right, sample_bottom

The number of pixels to sample from each side. Defaults to 20.

random

Randomly sampling of the edge's pixels? Defaults to FALSE.

filter

Apply a median filter in the sampled pixels? Defaults to FALSE.

plot

Plots the extended image? defaults to FALSE.

Value

An Image object

Examples

library(pliman)
img <- image_pliman("soybean_touch.jpg")
image_expand(img, left = 200)
image_expand(img, right = 150, bottom = 250, filter = 5)


pliman documentation built on Oct. 15, 2023, 1:06 a.m.

Related to image_expand in pliman...