| ▲ | b_mc2 2 hours ago | |
These are two articles I liked that are referenced in the Python ImageHash library on PyPi, second article is a follow-up to the first. Here's paraphrased steps/result from first article for hashing an image: 1. Reduce size. The fastest way to remove high frequencies and detail is to shrink the image. In this case, shrink it to 8x8 so that there are 64 total pixels. 2. Reduce color. The tiny 8x8 picture is converted to a grayscale. This changes the hash from 64 pixels (64 red, 64 green, and 64 blue) to 64 total colors. 3. Average the colors. Compute the mean value of the 64 colors. 4. Compute the bits. Each bit is simply set based on whether the color value is above or below the mean. 5. Construct the hash. Set the 64 bits into a 64-bit integer. The order does not matter, just as long as you are consistent. The resulting hash won't change if the image is scaled or the aspect ratio changes. Increasing or decreasing the brightness or contrast, or even altering the colors won't dramatically change the hash value. https://www.hackerfactor.com/blog/index.php?/archives/432-Lo... https://www.hackerfactor.com/blog/index.php?/archives/529-Ki... | ||