match_signatures_pairwise: Match pairs of images based on colour signatures

View source: R/match_signatures_pairwise.R

match_signatures_pairwiseR Documentation

Match pairs of images based on colour signatures

Description

match_signatures_pairwise takes two vectors of image signatures and produces a vector of Hamming distances between the pairwise elements of the signatures.

Usage

match_signatures_pairwise(x, y, distance = ~nearest * bilinear)

Arguments

x, y

Vectors of class matchr_signature to be matched.

distance

A one-sided formula (or character string which can be coerced to a formula) with one or both of the terms nearest and bilinear, expressing how the Hamming distance between image signature vectors should be calculated. The default (~nearest * bilinear) takes the Hamming distances of each of the two image signature components and multiplies them together. Any arithmetical combination of these distances is a valid argument to distance, e.g. ~ nearest + log(bilinear).

Details

While match_signatures produces a matrix of Hamming distances between each of the x elements and each of the y elements, sometimes it is helpful to simply calculate Hamming distances between pairs of elements in each vector—e.g. x[i] and y[i], x[j] and y[j], etc. match_signatures_pairwise calculates these pairwise distances and returns a numeric vector.

Value

A numeric vector, each element v[i] of which is the Hamming distance between the x[i] and y[i] signatures. The formula supplied to the distance argument will be present as an additional attribute to the return vector, named formula.

Examples

## Not run: 
# Setup
sigs <- create_signature(example_urls)

# Find pairwise matches between vectors
match_signatures_pairwise(sigs, sigs)

## End(Not run)

UPGo-McGill/matchr documentation built on July 19, 2023, 1:02 p.m.