What Is a Hashing Algorithm?

Perceptual hashing algorithms (hereinafter referred to as AHA) are a type of hashing algorithms that are mainly used to search for similar pictures.

Mean hash algorithm

Right!
Perceptual hashing algorithms (hereinafter referred to as AHA) are a type of hashing algorithms that are mainly used to search for similar pictures.
Chinese name
Mean hash algorithm
Foreign name
Average hash algorithm
Types of
Entry
Short name
AHA
AHA is a general term for a class of comparative hashing methods. The features contained in the picture are used to generate a set of fingerprints (though it is not unique), and these fingerprints can be compared.
The following are simple steps to illustrate the AHA calculation process on the image [1] :
The first step is to reduce the size.
The fastest way to remove high frequencies and details, and only keep the structure light and dark is to reduce the size.
Reduce the image to 8x8 size for a total of 64 pixels. Discard image differences caused by different sizes and proportions.
The second step is to simplify the color.
Convert the reduced image to 64-level grayscale. In other words, all pixels have only 64 colors in total.
The third step is to calculate the average.
Calculate the average gray value of all 64 pixels.
The fourth step is to compare the gray levels of the pixels.
Compare the gray level of each pixel with the average. Greater than or equal to the average, recorded as 1; less than the average, recorded as 0.
The fifth step is to calculate the hash value.
The comparison results of the previous step are combined to form a 64-bit integer. This is the fingerprint of this picture. The order of composition is not important, as long as all pictures are in the same order.
If the picture is enlarged or reduced, or the aspect ratio is changed, the resulting value will not change. Increasing or decreasing brightness or contrast, or changing colors, will not have much effect on the hash value. The biggest advantage: fast calculation speed!
If you want to compare two pictures, construct a hash value for each picture and count the number of different bits. (Hamming distance) If this value is 0, it means that the two pictures are very similar. If the Hamming distance is less than 5, it means that they are slightly different, but they are similar. If the Hamming distance is greater than 10, it means completely different pictures.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?