This function takes either a matrix, array or a folder and returns either the binary hash features or the hashes (as a character vector)
hash_apply(
object,
rows = 28,
columns = 28,
hash_size = 8,
highfreq_factor = 3,
method = "phash",
mode = "binary",
threads = 1,
resize = "nearest"
)
If the input is a matrix, data frame or array this function returns a matrix (if mode = 'binary') or a character vector (if mode = 'hex_hash'). If the input is a path to a folder the function returns a list of length 2, the 1st sublist is a vector with the names of the image files (the order of the files in the vector corresponds to the order of the rows of the output matrix), the 2nd sublist is a matrix (if mode = 'binary') or a character vector (if mode = 'hex_hash').
a matrix, a data frame, a 3-dimensional array (where the third dimension is equal to 3) or a path to a folder of files (images)
a number specifying the number of rows of the matrix
a number specifying the number of columns of the matrix
an integer specifying the hash size. IF method = 'phash' : the hash_size * highfreq_factor should be less than number of rows or columns of the gray_image. IF method = 'dhash' or 'average_hash' : the hash_size should be less than number of rows or columns of the gray_image
an integer specyfing the highfrequency factor (IF method = 'phash' : the hash_size * highfreq_factor should be less than number of rows or columns of the gray_image)
one of 'phash', 'average_hash', 'dhash'
one of 'binary', 'hash'
the number of cores to run in parallel
corresponds to one of 'nearest', 'bilinear' (resizing method)
This function calculates the binary hash or the hexadecimal hash for various types of objects.
path = paste0(system.file("tmp_images", "same_type", package = "OpenImageR"), '/')
res_phash = hash_apply(path, method = 'phash', mode = 'binary')
Run the code above in your browser using DataLab