| centre | R Documentation |
Transforms selected frames so that two user-supplied reference points (e.g.
left and right eye positions) map onto the same pixel locations across all
frames. The transformation is a full affine warp — rotation, scaling, and
translation are applied simultaneously — computed from the two point
correspondences via magick::image_distort.
centre(images, points, reference = 1L, frames = NULL)
center(images, points, reference = 1L, frames = NULL)
images |
an object of class |
points |
a |
reference |
integer. The frame whose reference points define the target
alignment. All other selected frames are warped to match it. The reference
frame itself is left unchanged. Defaults to |
frames |
integer vector of frame indices to duplicate. Defaults to
|
a magick-image object of the same length as images.
After each operation a message listing the updated frame sequence is
printed in interactive sessions. Use
stopmotion_verbosity(FALSE) to suppress these messages, or set
options(stopmotion.verbose = FALSE) in your script or
‘.Rprofile’.
dino_dir <- system.file("extdata", package = "stopmotion")
images <- read(dir = dino_dir)
# Manually record eye positions for each frame (e.g. using locator())
points <- data.frame(
frame = c(1L, 1L, 2L, 2L, 3L, 3L),
x = c(210, 390, 215, 388, 208, 392),
y = c(180, 182, 176, 179, 183, 181)
)
centre(images = images, points = points, reference = 1L, frames = 1:3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.