In [81]:
import glob
import os
%load_ext autoreload
%autoreload 2
os.chdir(r"D:\Dev\Tinker\Python")
The autoreload extension is already loaded. To reload it, use:
%reload_ext autoreload
In [82]:
from imagematch.matcher import ImageInfo
In [83]:
for filepath in ImageInfo.GetFiles(r"G:\Luggage\Backups\Pictures", recurse=True):
ImageInfo(filepath).register()
In [84]:
list(ImageInfo.Matches())
Out[84]:
[<ImageInfo(filepath=G:\Luggage\Backups\Pictures\haircut.jpg, dhash=0a0e0c1e261f1341, phash=0a0e0c1e261f1341, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\haircut.jpg, G:\Luggage\Backups\Pictures\haircut.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\itsme.jpg, dhash=2767636b79697c78, phash=2767636b79697c78, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\THISONE.jpg, G:\Luggage\Backups\Pictures\itsme.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\THISONE.jpg, dhash=2767636b79697c78, phash=2767636b79697c78, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\THISONE.jpg, G:\Luggage\Backups\Pictures\itsme.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\front.jpg, dhash=88cccc2c64e48763, phash=88cccc2c64e48763, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\front_t.jpg, G:\Luggage\Backups\Pictures\Blog\front.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\front_t.jpg, dhash=88cccc2c64e48763, phash=88cccc2c64e48763, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\front_t.jpg, G:\Luggage\Backups\Pictures\Blog\front.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\newtabs.jpg, dhash=8391f2f4f404646c, phash=8391f2f4f404646c, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\newtabss.jpg, G:\Luggage\Backups\Pictures\Blog\newtabs.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\newtabss.jpg, dhash=8391f2f4f404646c, phash=8391f2f4f404646c, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\newtabss.jpg, G:\Luggage\Backups\Pictures\Blog\newtabs.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\setaf2.jpg, dhash=c1b2d4d4d4d4d4a4, phash=c1b2d4d4d4d4d4a4, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\setaf2t.jpg, G:\Luggage\Backups\Pictures\Blog\setaf2.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\setaf2t.jpg, dhash=c1b2d4d4d4d4d4a4, phash=c1b2d4d4d4d4d4a4, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\setaf2t.jpg, G:\Luggage\Backups\Pictures\Blog\setaf2.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\windowslive.gif, dhash=cca28682b2f6d292, phash=cca28682b2f6d292, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\windowslive1s.jpg, G:\Luggage\Backups\Pictures\Blog\windowslive.gif), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\windowslive1s.jpg, dhash=cca28682b2f6d292, phash=cca28682b2f6d292, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\windowslive1s.jpg, G:\Luggage\Backups\Pictures\Blog\windowslive.gif), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\grits\haircut.jpg, dhash=0a0e0c1e261f1341, phash=0a0e0c1e261f1341, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\haircut.jpg, G:\Luggage\Backups\Pictures\haircut.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\grits\WW2\font1024.jpg, dhash=f1c0c7dbc8987070, phash=f1c0c7dbc8987070, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\WW2\font1152.jpg, G:\Luggage\Backups\Pictures\grits\WW2\font1024.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\grits\WW2\font1152.jpg, dhash=f1c0c7dbc8987070, phash=f1c0c7dbc8987070, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\WW2\font1152.jpg, G:\Luggage\Backups\Pictures\grits\WW2\font1024.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\grits\WW2\lawnbannerbig.jpg, dhash=7577c6c9c9983135, phash=7577c6c9c9983135, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\WW2\lawnbannermid.jpg, G:\Luggage\Backups\Pictures\grits\WW2\lawnbannerbig.jpg), dhash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\grits\WW2\lawnbannermid.jpg, dhash=7577c6c9c9983135, phash=7577c6c9c9983135, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\WW2\lawnbannermid.jpg, G:\Luggage\Backups\Pictures\grits\WW2\lawnbannerbig.jpg), dhash=0.000000)>])>]
In [85]:
ImageInfo.PHashFilter()
In [86]:
list(ImageInfo.Matches())
Out[86]:
[<ImageInfo(filepath=G:\Luggage\Backups\Pictures\haircut.jpg, dhash=0a0e0c1e261f1341, phash=0a0e0c1e261f1341, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\haircut.jpg, G:\Luggage\Backups\Pictures\haircut.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\itsme.jpg, dhash=2767636b79697c78, phash=2767636b79697c78, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\THISONE.jpg, G:\Luggage\Backups\Pictures\itsme.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\THISONE.jpg, dhash=2767636b79697c78, phash=2767636b79697c78, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\THISONE.jpg, G:\Luggage\Backups\Pictures\itsme.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\front.jpg, dhash=88cccc2c64e48763, phash=88cccc2c64e48763, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\front_t.jpg, G:\Luggage\Backups\Pictures\Blog\front.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\front_t.jpg, dhash=88cccc2c64e48763, phash=88cccc2c64e48763, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\front_t.jpg, G:\Luggage\Backups\Pictures\Blog\front.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\newtabs.jpg, dhash=8391f2f4f404646c, phash=8391f2f4f404646c, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\newtabss.jpg, G:\Luggage\Backups\Pictures\Blog\newtabs.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\newtabss.jpg, dhash=8391f2f4f404646c, phash=8391f2f4f404646c, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\newtabss.jpg, G:\Luggage\Backups\Pictures\Blog\newtabs.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\setaf2.jpg, dhash=c1b2d4d4d4d4d4a4, phash=c1b2d4d4d4d4d4a4, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\setaf2t.jpg, G:\Luggage\Backups\Pictures\Blog\setaf2.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\setaf2t.jpg, dhash=c1b2d4d4d4d4d4a4, phash=c1b2d4d4d4d4d4a4, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\setaf2t.jpg, G:\Luggage\Backups\Pictures\Blog\setaf2.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\windowslive.gif, dhash=cca28682b2f6d292, phash=cca28682b2f6d292, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\windowslive1s.jpg, G:\Luggage\Backups\Pictures\Blog\windowslive.gif), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\Blog\windowslive1s.jpg, dhash=cca28682b2f6d292, phash=cca28682b2f6d292, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\Blog\windowslive1s.jpg, G:\Luggage\Backups\Pictures\Blog\windowslive.gif), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\grits\haircut.jpg, dhash=0a0e0c1e261f1341, phash=0a0e0c1e261f1341, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\haircut.jpg, G:\Luggage\Backups\Pictures\haircut.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\grits\WW2\font1024.jpg, dhash=f1c0c7dbc8987070, phash=f1c0c7dbc8987070, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\WW2\font1152.jpg, G:\Luggage\Backups\Pictures\grits\WW2\font1024.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\grits\WW2\font1152.jpg, dhash=f1c0c7dbc8987070, phash=f1c0c7dbc8987070, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\WW2\font1152.jpg, G:\Luggage\Backups\Pictures\grits\WW2\font1024.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\grits\WW2\lawnbannerbig.jpg, dhash=7577c6c9c9983135, phash=7577c6c9c9983135, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\WW2\lawnbannermid.jpg, G:\Luggage\Backups\Pictures\grits\WW2\lawnbannerbig.jpg), phash=0.000000)>])>,
<ImageInfo(filepath=G:\Luggage\Backups\Pictures\grits\WW2\lawnbannermid.jpg, dhash=7577c6c9c9983135, phash=7577c6c9c9983135, matches=[<ImageMatch(files=(G:\Luggage\Backups\Pictures\grits\WW2\lawnbannermid.jpg, G:\Luggage\Backups\Pictures\grits\WW2\lawnbannerbig.jpg), phash=0.000000)>])>]
In [ ]:
Content source: kfsone/tinker
Similar notebooks: