frameDist {EBImage} | R Documentation

## Calculate pairwise distances between image frames or frames of two images

### Description

Given two images with multiple frames, `frameDist` calculates a matrix of distances between frames (the more similar are the images, the smaller are the distances). Prerequisite: images should be centered and rotationally and scale aligned. The function is recommended with `stackObjects` with arguments `rotate=combine=TRUE`.

### Usage

      ## S4 method for signature 'Image, Image':
      frameDist(x, y, r, g, b, blur=TRUE,
          method="dist", verbose, ...)
      ## S4 method for signature 'Image, missing':
      frameDist(x, y, r, g, b, blur=TRUE,
          method="dist", verbose, ...)

### Arguments

`x,y` | A image stacks.
`r,b,g` | If `x` and `y` are in TrueColor mode, these values specify weights of red, green and blue channels in the resulting distance.
`blur` | A logical indicating whether frames ought to be blurred before comparison (`TRUE` recommended).
`method` | Method to use: `dist` - Euclidian distance, `dot` - dot product.
`verbose` | Provides additional output as the function can be lengthy.
`...` | Reserved.

### Details

For Grayscale images, the distance of each pair of frames, `xf` and `yf`, is calculated as `mean(abs(xf-yf))`, where `mean` is taken over the pixels with at least `xf` or `yf` being non-zero. For TrueColor images, the distance is calculated as `mean(sqrt(r*rc^2+g*gc^2+b*bc^2))`, where `rc,gc,bc` are `[0,1]` ranged values of red, green and blue channels and `r,g,b` are the weights. Again, the mean is taken only over non-zero pixels.

### Value

A matrix of distances. If `y` is missing - a square symmetric matrix for the distances between frames in the same image with diagonal elements set at `Inf`.

### Author(s)

Oleg Sklyar, osklyar@ebi.ac.uk, 2007

### See Also

`stackObjects`

[Package EBImage version 2.4.0 Index]