imchange {imager} | R Documentation |
Modify parts of an image
Description
A shortcut for modifying parts of an image, using imeval syntax. See doc for imeval first. As part of a pipe, avoids the creating of intermediate variables.
Usage
imchange(obj, where, fo, env = parent.frame())
Arguments
obj |
an image or imlist |
where |
where to modify. a pixset, or a formula (in imeval syntax) that evaluates to a pixset. |
fo |
a formula (in imeval syntax) used to modify the image part |
env |
evulation environment (see imeval) |
Value
a modified image
Author(s)
Simon Barthelme
See Also
imeval
Examples
#Set border to 0:
imchange(boats,px.borders(boats,10),~ 0) %>% plot
#Eq. to
im <- boats
im[px.borders(im,10)] <- 0
#Using formula syntax
imchange(boats,~ px.borders(.,10),~ 0)
#Replace with grayscale ramp
imchange(boats,~ px.borders(.,10),~ xs) %>% plot
#Kill red channel in image
imchange(boats,~ c==1,~ 0) %>% plot
#Shit hue by an amount depending on eccentricity
load.example("parrots") %>%
RGBtoHSL %>%
imchange(~ c==1,~ .+80*exp(-(rho/550)^2) ) %>%
HSLtoRGB %>%
plot
[Package imager version 1.0.2 Index]