morph | R Documentation |
Given a set of images, rotate them to the same orientation (with img_make_horizontal()
), align them to their centroid (with img_center()
), average them, and, optionally, adjust the grey levels of the resulting, morphed, image (see adjust_grey
).
morph(
x,
adjust_grey = FALSE,
threshold = 2/255,
invert = TRUE,
fun = NULL,
...
)
x |
list of images, of type |
adjust_grey |
whether to adjust the mean grey level of the morphed image to match that of the original images it was constructed with. Usually, computing the average (i.e. the morphing) results in lighter images; this compensates it a little. Note that it requires more intense computation and is therefore switched off by default. |
threshold |
grey level threshold used to separate the foreground object from the background for the adjustment of grey level. Ignored when |
invert |
passed to |
fun |
function to apply to each image, as a pre-processing step (a typical one is |
... |
passed to |
The morphed image, as a imager::cimg()
object.
# get a list of images to morph
amph <- list.files(system.file("extdata", "amphipoda",
package="morphr"), full.names=TRUE)
# read and plot a couple
img_read(amph[1]) %>% img_show()
img_read(amph[3]) %>% img_show()
# now morph them all
morph(amph) %>% img_show()
morph(amph, adjust_grey=TRUE) %>% img_show()
cres <- list.files(system.file("extdata", "creseidae",
package="morphr"), full.names=TRUE)
img_read(cres[1]) %>% img_show()
img_read(cres[2]) %>% img_show()
morph(cres) %>% img_show()
morph(cres, adjust_grey=TRUE) %>% img_show()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.