Skip to contents

Transform a base image in shape, color, and/or texture by the differences between two images.

Usage

trans(
  trans_img = NULL,
  from_img = NULL,
  to_img = NULL,
  shape = 0,
  color = 0,
  texture = 0,
  outname = NULL,
  norm = c("none", "twopoint", "rigid"),
  normpoint = 0:1,
  sample_contours = TRUE,
  warp = c("multiscale", "linear", "multiscalerb")
)

Arguments

trans_img

list of stimuli to transform

from_img

negative transform dimension endpoint (0% image)

to_img

positive transform dimension endpoint (100% image)

shape, color, texture

amount to change along the vector defined by from_img and to_img (can range from -3 to +3)

outname

name to save each image as

norm

how to normalise the images; see Details

normpoint

points for twopoint normalisation

sample_contours

whether to sample contours or just points

warp

warp type

Value

list of stimuli with transformed images and templates

Details

Normalisation options

  • none: averages will have all coordinates as the mathematical average of the coordinates in the component templates

  • twopoint: all images are first aligned to the 2 alignment points designated in normpoint. Their position is set to their position in the first image in stimuli

  • rigid: procrustes aligns all images to the position of the first image in stimuli

Sample contours

This interpolates more control points along the lines. This can improve the accuracy of averages and transforms. If you see a “feathery” appearance along lines that have many, close-together points, try turning this off.

Warp types

  • multiscale: Implements multi-scale affine interpolation for image warping. This is the default, with a good balance between speed and accuracy

  • linear: Implements triangulated linear interpolation for image warping. Linear warping is least accurate, often resulting in image artifacts, but is very fast.

  • multiscalerb: Implements multi-scale rigid body interpolation for image warping. This decreases image artifacts in some circumstances, but is much slower.

See also

WebMorph.org functions avg(), continuum(), loop(), symmetrize(), webmorph_up()

Examples

# \donttest{
if (webmorph_up()) {
  stimuli <- demo_stim()
  sexdim <- trans(stimuli, stimuli$f_multi, stimuli$m_multi,
                  shape = c(fem = -0.5, masc = 0.5))
  
  sexdim |> draw_tem() |> label()
}

# }