Skip to contents

This is just a convenient way to use magick::compareare with webmorph stimuli. It defaults to the "MSE" metric, which gives a linearly increasing score to images along a morph continuum.

Usage

compare(stimuli, ref_stim, metric = "MSE", fuzz = 0, scale = FALSE)

Arguments

stimuli

Stimuli to compare to the ref_stim

ref_stim

A stim, 1-item stimlist, or the name or index of the comparison item in stim

metric

string with a metric from magick::metric_types(): "Undefined", "AE", "Fuzz", "MAE", "MEPP", "MSE", "NCC", "PAE", "PHASH", "PSNR", "RMSE"

fuzz

relative color distance (value between 0 and 100) to be considered similar in the filling algorithm (only useful for AE)

scale

whether to scale the values so that the maximum value is 1 and the minimum is 0 (only useful when stim is more than 1 image and includes ref_stim)

Value

Difference metric

Details

Metric Types

  • Undefined: ?

  • AE: Absolute Error

  • Fuzz: ?

  • MAE: Mean Absolute Error

  • MEPP: Mean Error Per Pixel

  • MSE: Mean Squared Error

  • NCC: Normalized Cross Correlation

  • PAE: Peak Absolute Error

  • PHASH: Perceptual Hash

  • PSNR: Peak Signal-to-Noise Ratio

  • RMSE: Root Mean Squared Error

How these metrics behave when comparing a morph continuum to its first image.

Increases with morph distance:

  • very strong negative exponential decay at 0 fuzz; more linear with higher fuzz: AE

  • strong negative exponential decay: PAE

  • slight negative exponential decay: Fuzz, RMSE

  • linear: MAE, MEPP, MSE

  • no idea: PHASH

Decreases with morph distance:

  • linear: NCC, Undefined

  • slight exponential decay: PSNR

See also

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

Examples

stimuli <- demo_stim()
compare(stimuli, stimuli$m_multi)
#>    f_multi    m_multi 
#> 0.01020267 0.00000000 
compare(stimuli, stimuli$m_multi, "AE")
#> f_multi m_multi 
#>  247477       0 
compare(stimuli, stimuli$m_multi, "AE", fuzz = 5)
#> f_multi m_multi 
#>   93112       0