modif: Apply material editing effect

View source: R/materialmodifier.R

modifR Documentation

Apply material editing effect

Description

This function is the core function of this package. It edits the input image by specifying the name of the editing effect (BS feature or its alias) and the strength parameter.

Usage

modif(
  im,
  effect,
  strength,
  mask = NA,
  max_size = 1280,
  log_epsilon = 1e-04,
  filter_epsilon = 0.01,
  logspace = TRUE
)

Arguments

im

An input image.

effect

A string naming the effect to apply. Either "gloss", "shine", "spots", "blemish", "rough", "stain", "shadow", or "aging".

strength

A numeric, which controls the strength of the effect. Strength values between 0 and 1 will reduce a feature, while strength values larger than 1 will boost a feature. A strength value of 1 does nothing. Negative values are allowed, which will invert a feature.

mask

If set, only the area of white pixels in the mask image will be edited.

max_size

If the shorter side of the input image is larger than this value (the default is 1280), input image is resized before applying effects. Because the modif() function is very slow for large-resolution images, it is useful to limit the image resolution to speed-up the image processing. If you do not want to change the resolution of the input image, you can enter a large value for max_size, or set max_size = NA

log_epsilon

Offset for log transformation (default is 0.0001). Need not to change this value in most cases.

filter_epsilon

Epsilon parameter of the Guided filter (default is 0.01). Need not to change this value in most cases.

logspace

If TRUE (default), image processing is done in the log space. If FALSE, computation is performed without log transformation.

Value

an output image

Examples


plot(modif(face, effect = "shine", strength = 2.5)) # Apply the "shine" effect (make objects shiny)
plot(modif(face, effect = "shine", strength = 0.2)) # Less shiny effect with a parameter less than 1
plot(modif(face, effect = c("shine", "stain"), strength = c(0.2, 3))) # Less shiny and more stain


materialmodifier documentation built on May 31, 2023, 9:46 p.m.