imchange | R Documentation |
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.
imchange(obj, where, fo, env = parent.frame())
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) |
a modified image
Simon Barthelme
imeval
#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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.