Skip to contents

Get metrics defined by template points.

Usage

metrics(stimuli, formula = c(0, 1))

Arguments

stimuli

list of stimuli with tems

formula

a vector of two points to measure the distance apart, or a string of the formula for the metric

Value

named vector of the metric

Details

Reference x and y coordinates by point number like x[0] or y[188]. Use any R functions to process the numbers, as well as pow() (same as ^(), for consistency with webmorph.org). Remember that 0,0 is the top left for images; e.g., min(y[0], y[1]) gives your the higher of the two pupil y-coordinates.

See also

Other info: add_info(), compare(), get_info(), get_point(), height(), rename_stim(), width()

Examples

stimuli <- demo_stim()

metrics(stimuli, c(0, 1)) # eye-spacing
#>  f_multi  m_multi 
#> 77.40749 75.37856 

# face width-to-height ratio
fwh <- "abs(max(x[113],x[112],x[114])-min(x[110],x[111],x[109]))/abs(y[90]-min(y[20],y[25]))"
metrics(stimuli, fwh)
#>  f_multi  m_multi 
#> 2.203814 2.162650