This function calculates the dhash of an image
dhash(gray_image, hash_size = 8, MODE = "hash", resize = "nearest")
a (2-dimensional) matrix or data frame
an integer specifying the hash size (should be less than number of rows or columns of the gray_image)
one of 'hash' (returns the hash of the image), 'binary' (returns binary identifier of the image)
corresponds to one of 'nearest', 'bilinear'
either a hash-string or a binary vector
The function is a modification of the 'dhash' function of the imagehash package [ please consult the COPYRIGHT file ]. In comparison to average_hash and phash, the dhash algorithm takes into consideration the difference between adjacent pixels.
image = readImage(system.file("tmp_images", "3.jpeg", package = "OpenImageR"))
image = rgb_2gray(image)
res_hash = dhash(image, hash_size = 8, MODE = 'hash')
res_binary = dhash(image, hash_size = 8, MODE = 'binary')