View source: R/create_signature.R
create_signature | R Documentation |
create_signature
takes a vector of image or file paths and generates
"perceptual hashes" which allow similar images to be matched with each other.
create_signature(image, rm_black_bars = TRUE, ...)
## S3 method for class 'matchr_image'
create_signature(image, rm_black_bars = TRUE, quiet = FALSE, ...)
## S3 method for class 'character'
create_signature(
image,
rm_black_bars = TRUE,
backup = TRUE,
quiet = FALSE,
...
)
image |
Vector of class |
rm_black_bars |
Logical scalar. Should horizontal black bars be detected and removed from the image signature? Because these bands lead to an image signature dominated by black values, leaving them in the signature can lead to false positive matches. |
... |
Additional arguments passed to methods. |
quiet |
A logical scalar. Should the function execute quietly, or should it return status updates throughout the function (default)? |
backup |
A logical scalar. Should the function store an ongoing backup
of progress in a hidden object |
Images are down-sampled to 8x8 greyscale bitmaps and passed through a discrete cosine transformation, from which 128-bit signatures are calculated. These signatures can identify a given image even if the image is rescaled or compressed, and thus serves as a reliable indicator of whether two images are the same.
A vector of class matchr_signature
of the same length as the input
vector.
## Not run:
# Import image with load_image then create signature
img <- load_image(test_urls)
create_signature(img)
# Or create signature directly from path/URL
create_signature(test_urls)
# By default top/bottom black bars are removed, but leave them with rm_black_bars = FALSE
create_signature(img, rm_black_bars = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.