Estella / ImageDNA

opensource photo matching

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImageDNA

ImageDNA

opensource photo matching based on the PhotoDNA concepts. I read about this years ago and thought it was interesting so decided to see what was involved with it. Rotations and mirror/flips will need to be added to reorient the images to have a higher degree of matching success.

Used this as a reference: https://news.microsoft.com/en-gb/2013/11/18/tacklingproliferatio/

test.php - estella.png vs estella.jpg

Test Image 1 Test Image 2

Image MD5: ec58cf2a0a239423acf6cff44b35a1c9
ImageDNA: 153,157,154,62,32,62,100,33,33,26,16,69,76,107,108,94,169,173,170,133,16,106,152,55,36,42,30,29,54,113,110,102,172,177,174,170,120,174,157,63,34,54,45,11,40,99,110,105,174,178,177,174,192,142,168,68,47,57,32,6,31,94,104,100,176,181,178,190,197,142,190,83,80,80,21,3,19,90,108,104,177,181,186,202,177,146,197,125,106,113,49,5,11,86,102,108,177,184,202,194,181,137,194,162,103,134,115,13,7,76,102,103,178,197,206,178,200,166,197,193,166,133,130,19,10,31,85,101,184,206,182,196,210,158,198,198,170,142,101,34,46,29,25,76,198,196,186,208,206,174,204,197,140,149,78,54,55,43,23,15,198,178,202,212,206,176,202,200,112,86,59,61,60,58,46,23,176,196,210,208,205,170,204,198,105,51,65,49,54,47,61,38,141,198,206,206,208,185,205,198,122,47,48,50,41,45,56,52,148,204,200,209,206,208,202,204,166,48,42,36,36,45,59,55,198,205,205,205,206,205,204,208,206,75,41,33,34,24,49,70,184,193,193,193,189,192,198,201,192,110,41,33,27,20,17,33 = 30965

Image MD5: 62b293e3842e0d24181ff6ccd3d6b0d8
ImageDNA: 153,157,154,62,32,62,100,33,33,26,16,69,76,107,108,94,169,173,170,133,16,106,152,56,36,42,30,29,54,113,110,101,172,177,174,170,120,174,157,63,34,54,45,11,40,99,110,105,174,178,177,174,192,154,168,68,47,57,32,6,31,94,104,100,176,181,178,190,197,132,190,83,80,80,21,3,19,90,108,104,177,181,186,202,177,152,197,125,106,113,49,5,11,86,102,108,177,184,202,193,181,149,194,162,103,134,115,13,7,76,102,103,178,197,206,178,200,149,197,193,166,133,130,19,10,31,85,101,184,206,182,197,210,168,198,198,170,142,101,34,46,29,25,76,198,196,186,208,206,172,204,197,140,149,78,54,54,43,23,15,198,178,202,212,206,172,202,200,112,86,59,61,60,58,46,23,176,196,210,208,205,176,204,198,105,51,65,49,54,47,61,38,141,198,206,206,209,190,205,198,122,47,48,50,41,45,56,52,148,204,200,209,206,208,202,204,166,49,42,36,36,45,59,55,198,205,205,205,206,205,204,208,206,75,41,34,34,24,49,70,184,193,193,193,189,193,197,201,192,110,41,33,27,20,17,33 = 30985

test2.php - estella.png vs letseat.jpg

Test Image 1 Test Image 2

Image MD5: ec58cf2a0a239423acf6cff44b35a1c9
ImageDNA: 153,157,154,62,32,62,100,33,33,26,16,69,76,107,108,94,169,173,170,133,16,106,152,55,36,42,30,29,54,113,110,102,172,177,174,170,120,174,157,63,34,54,45,11,40,99,110,105,174,178,177,174,192,142,168,68,47,57,32,6,31,94,104,100,176,181,178,190,197,142,190,83,80,80,21,3,19,90,108,104,177,181,186,202,177,146,197,125,106,113,49,5,11,86,102,108,177,184,202,194,181,137,194,162,103,134,115,13,7,76,102,103,178,197,206,178,200,166,197,193,166,133,130,19,10,31,85,101,184,206,182,196,210,158,198,198,170,142,101,34,46,29,25,76,198,196,186,208,206,174,204,197,140,149,78,54,55,43,23,15,198,178,202,212,206,176,202,200,112,86,59,61,60,58,46,23,176,196,210,208,205,170,204,198,105,51,65,49,54,47,61,38,141,198,206,206,208,185,205,198,122,47,48,50,41,45,56,52,148,204,200,209,206,208,202,204,166,48,42,36,36,45,59,55,198,205,205,205,206,205,204,208,206,75,41,33,34,24,49,70,184,193,193,193,189,192,198,201,192,110,41,33,27,20,17,33 = 30965

Image MD5: ef31f4ee51c395745d533324b193ded2
ImageDNA: 138,132,137,169,190,198,205,202,206,214,213,200,174,165,153,142,138,134,141,177,178,190,214,213,214,220,213,193,178,172,158,145,136,137,148,186,198,206,220,220,180,170,201,221,201,181,162,146,137,142,157,201,209,221,194,201,48,113,197,220,241,220,168,158,137,148,170,214,204,216,209,181,54,169,206,198,177,198,185,189,81,75,192,216,230,212,202,184,188,150,134,192,185,202,222,194,94,157,213,192,127,190,189,190,176,50,37,51,233,233,217,188,99,208,202,182,125,228,194,186,149,73,37,39,240,234,218,176,110,208,225,210,200,234,214,214,162,110,39,38,226,229,209,174,138,209,205,174,164,217,204,218,170,99,62,39,217,230,209,172,153,206,218,185,117,220,181,168,88,48,66,84,194,170,177,188,146,182,200,174,212,216,205,197,190,237,201,189,186,176,142,182,154,160,184,168,222,197,194,218,221,197,206,205,204,193,160,156,134,146,166,169,173,184,214,201,186,196,198,200,186,185,142,124,132,140,149,178,181,190,192,182,202,196,189,186,169,173,186,142,130,134,142,170,180,182,189,190,190,190,188,186,156,148,146,137 = 44612

debug_1.php - Step 1: Convert Image to Grayscale / Black & White

debug_image 1

debug_2.php - Step 2: Resize Image to fixed height/width default is 512x512

debug_image 2

debug_3.php - Step 3: Break up the image into grid and cells default 32x32, create an average of the cell's pixel color

debug_image 3 Single Cell in upper left for debug demo

debug_4.php - Step 4: Combine all the cells back together to a pixelated version

debug_image 4

debug_5.php - Step 5: Resize image to where cells are 1 pixel in height/width, default 16 pixels.

debug_image 5

Final Step

After all the steps are complete, pixels are converted to their 0xFF bytes and stored within an array that acts as the DNA, which 16x16 DNA image results in 256 values. These are sumed to compute an easy to see delta when comparing to another image's DNA.

The closer the numbers the more likely a match, looking at the DNA can rule out false positives, larger numbers mean greater divergence.

About

opensource photo matching

License:GNU General Public License v3.0


Languages

Language:PHP 100.0%