align: Align templates and images

Description Usage Arguments Value Examples

View source: R/align.R

Description

Align templates and images

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
align(
  stimuli,
  pt1 = 0,
  pt2 = 1,
  x1 = NULL,
  y1 = NULL,
  x2 = NULL,
  y2 = NULL,
  width = NULL,
  height = NULL,
  ref_img = 1,
  fill = webmorph_options("fill"),
  patch = FALSE,
  squash = FALSE,
  procrustes = FALSE
)

Arguments

stimuli

list of class stimlist

pt1

The first point to align (defaults to 0)

pt2

The second point to align (defaults to 1)

x1

The x-coordinate to align the first point to

y1

The y-coordinate to align the first point to

x2

The x-coordinate to align the second point to

y2

The y-coordinate to align the second point to

width

The width of the aligned image

height

The height of the aligned image

ref_img

The reference image (by index or name) to get coordinates and dimensions from if NULL (defaults to first image)

fill

background color if cropping goes outside the original image

patch

whether to use the patch function to set the background color

squash

whether to move template points outside the image boundaries inside the image

procrustes

Whether to do a procrustes alignment

Value

stimlist with aligned tems and/or images

Examples

1
2
3
stimuli <- demo_stim("lisa")[1:2]
align(stimuli) %>% plot()
align(stimuli, procrustes = TRUE) %>% plot()

facelab/webmorph documentation built on April 11, 2021, 6:34 a.m.