identify_matches: Identify matches from a matchr image matrix

View source: R/identify_matches.R

identify_matchesR Documentation

Identify matches from a matchr image matrix

Description

identify_matches analyzes a matchr_matrix vector of image signature Hamming distances to identify possible matches. By default it sets a low threshold for identifying matches, with the assumption that the results will be refined using confirm_matches, either within the function if confirm = TRUE, or subsequently with a separate function call.

Usage

identify_matches(x, y = NULL, threshold = 200, quiet = FALSE, ...)

## S3 method for class 'matchr_matrix'
identify_matches(x, y = NULL, threshold = 200, quiet = FALSE, ...)

## S3 method for class 'matchr_signature'
identify_matches(
  x,
  y = NULL,
  threshold = 200,
  quiet = FALSE,
  distance = ~nearest * bilinear,
  compare_ar = TRUE,
  stretch = 1.2,
  mem_scale = 0.2,
  ...
)

Arguments

x

A vector of class matchr_sig, containing image signatures produced by create_signature, or matchr_matrix, containing image signature Hamming distance matrices produced by match_signatures.

y

A vector of class matchr_sig, containing image signatures produced by create_signature. If x is not a matchr_sig vector, this argument is ignored, and will trigger a warning if a non-NULL value is supplied.

threshold

A numeric scalar. The maximum Hamming distance to consider images to be matched.

quiet

A logical scalar. Should the function execute quietly, or should it return status updates throughout the function (default)?

...

Additional arguments passed to methods.

distance, compare_ar, stretch, mem_scale

Arguments passed to match_signatures.

Value

A tibble if dplyr is installed or a data frame if not, with one row per identified match, and the following columns:

  • index: The match's index position in the input matchr_matrix vector. Each element is a length-three integer vector giving, respectively, the matrix, row index position, and column index position of the match.

  • x_sig and y_sig: matchr_signature vectors containing the image signatures which were matched.

  • distance: An integer vector giving the Hamming distance between the two files' image signatures. (The lower the distance, the more perceptually similar the images are.)

Examples

## Not run: 
# Setup
sigs <- create_signature(test_urls)
matches <- match_signatures(sigs)

# By default, confirm_matches will be called inside identify_matches
result <- identify_matches(matches)

# Skip this step with confirm = FALSE
result_no_confirm <- identify_matches(matches, confirm = FALSE)

## End(Not run)

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