This is a brief post of my notes describing the process to match similar images in an archive of photographs. I am using the techniques described by Adrian Rosebrock in his excellent article Image hashing with OpenCV and Python. The images used are from the Pompeii Artistic Landscape Project and provided courtesy of Pompeii in Pictures.
Image hashing is a process to match images through the use of a number that represents a very simplified form of an image, like this one below.
First, the color of the image is simplified. The image is converted to grayscale. See below:
Next, the image is simplified by size. It is resized 9 pixels wide by 8 pixels high.
Adrian Rosebrock uses a differential hash based on brightness to create a binary number of 64 bits. Each bit is 1 or 0. Two pixels next to each other horizontally are compared: left and right. If right is brighter, bit = 1. Bit = 0 if left is brighter. See below:
This process produces a 64bit binary number: 0101001100000011101001111000101110011101000011110000001001000011
This converts to decimal 5981808948155449923.
Matches
References
Dunn, Jackie and Bob Dunn. Pompeii in Pictures.
Rosebrock, Adrian. Image hashing with OpenCV and Python.