Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) use, ONLY. For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net. If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment. Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php Please read the Pointers For Use on my home page to properly install and customize my scripts. |
Computes the percent hamming distance between two binary string perceptual hashes.. |
last modified: January 29, 2022
USAGE: hamming [-p1 phash1] [-p2 phash2] [-s source] [-m method] [infile1] [infile2]
-p1 .. phash1 ...... optional first perceptual hash to compare to the second perceptual PURPOSE: To compute the percent hamming distance between two binary string perceptual hashes.
DESCRIPTION: HAMMING computes the percent hamming distance between two binary string
perceptual hashes. The two hashes strings may be privided directly or they may be
extracted from two input images in which one or more has hashes have been stored
for one of several hash methods. The potential hash methods that may be stored in
the images are as follows:
ARGUMENTS: -p1 phash1 ... PHASH1 is the optional first perceptual hash to compare to the second perceptual hash. The hash is a binary string of values. The number of binary digits in the string must match that of the second perceptual hash. Using PHASH1 and PHASH2 takes precedence over perceptual hashes provided in two optional input images. Infiles do not need to be provided if both phash1 and phash2 are provided. -p2 phash2 ... PHASH21 is the optional second perceptual hash to compare to the first perceptual hash. The hash is a binary string of values. The number of binary digits in the string must match that of the second perceptual hash. Using PHASH1 and PHASH2 takes precedence over perceptual hashes provided in two optional input images. Infiles do not need to be provided if both phash1 and phash2 are provided. -s source ... SOURCE location in in the two infiles' meta date to retrieve the perceptual hash values. The choices are: the "comment" (c) or "label" (l) fields in the images' meta data. The default=comment. -m method ... METHOD identifies which perceptual hash value to retrieve from the two images' meta data fields. More than one hash may be stored in the meta data field, but only one may be specified for computing the hamming distance. The choices are: bmh (block mean hash), bdh (block difference hash), avh (annular variance hash), pfh (polar fft hash). The default=bmh. CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
Example 1 --- Two Different Images |
Original Images |
|
hamming -s comment -m bmh lena.png barn.jpg |
Example 2 --- Two Similar Images |
Original Images |
|
hamming -m bmh -s comment lena.png lena_g1p2_r125x_gnoise.png |