图像相似度对比
图像相似度对比
Template matching 模板匹配
从一张图像里找出template图像,就是模板匹配,可以参考 https://stackoverflow.com/questions/47631852/detecting-and-comparing-shapes-between-two-images
Disadvantages of template matching
Well, the first disadvantage is that you need to know what you're looking for. If you're looking for dynamic features, you'll be better off using some other techniques.
Secondly, template matching provided by OpenCV doesn't let you check for rotations and scalings. If the P in our example was rotated by 90 degrees, the current program would never find it. You could write code for it though. A brute force algorithm would be to generate all possible rotations, all possible scales and then do the matching. But that would be extremely slow. So again, use some other techniques.
总结:对变化(translation, scale, rotation..)比较敏感,不抗变化.
Ref:
http://aishack.in/tutorials/template-matching/
形状对比: Hu Moment, Zernike Moment
形状对比, opencv matchshapes 使用的 Hu Moment https://www.learnopencv.com/shape-matching-using-hu-moments-c-python/(这个Link讲了什么是moment), 然后对比 Hu vector 相似性. Hu Moment 对形状的平移traslation,旋转 rotation,缩放scale 都认为是相似的图像,唯独对图像反转flip 认为不同.
Zernike Moment 比 Hu Moment 更强大 https://www.pyimagesearch.com/2014/04/07/building-pokedex-python-indexing-sprites-using-shape-descriptors-step-3-6/, translation, scale都认为不同,rotation认为相同
关于图像相似度算法除了Hash算法,在传统算法领域中还有基于SIFT的匹配算法,基于Gist特征的匹配算法
- http://www.sci.utah.edu/~gerig/CS7960-S2010/handouts/CS7960-AdvImProc-MomentInvariants.pdf
基于 keypoint 的算法
SIFT, SURF, ORB(前两种的升级版)
ORB https://www.kaggle.com/wesamelshamy/tutorial-image-feature-extraction-and-matching
Ref:
stackoverflow https://stackoverflow.com/questions/47631852/detecting-and-comparing-shapes-between-two-images
stackoverflow https://stackoverflow.com/questions/44785958/opencv-detect-changes-between-two-photos-taken-by-different-time
Hash类相似度算法可以参考 图像相似度中的Hash算法