Skip to contents

Applies the pair rules of ALGORITHMS.md: identical files, identical pixels, or visual similarity in any of eight orientations within the distance thresholds.

Usage

ri_compare(a, b, thresholds = default_thresholds)

Arguments

a, b

Fingerprints from ri_fingerprint().

thresholds

Maximum dHash and pHash Hamming distances (0 to 64) for a pair to count as "similar".

Value

NULL if the images are not related, otherwise a list with category, orientation, dhash_distance and phash_distance.

Examples

d <- ri_example_dir()
a <- ri_fingerprint(file.path(d, "gel_a.png"))
b <- ri_fingerprint(file.path(d, "gel_a_rot90.png"))
ri_compare(a, b)
#> $category
#> [1] "similar"
#> 
#> $orientation
#> [1] "rot270"
#> 
#> $dhash_distance
#> [1] 0
#> 
#> $phash_distance
#> [1] 0
#>