检查图像与OpenCV的相似性 [英] Checking images for similarity with OpenCV

查看:169
本文介绍了检查图像与OpenCV的相似性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenCV支持两个图像的比较,返回一些值(也许百分比),表明这些图像是多么相似?例如。

Does OpenCV support the comparison of two images, returning some value (maybe a percentage) that indicates how similar these images are? E.g. 100% would be returned if the same image was passed twice, 0% would be returned if the images were totally different.

我已经阅读了许多类似的主题了。堆栈溢出。我也做了一些谷歌。

I already read a lot of similar topics here on StackOverflow. I also did quite some Googling. Sadly I couldn't come up with a satisfieng answer.

推荐答案

这是一个非常巨大的话题,回答从3行代码到整个研究杂志。

This is a really huge topic, with answers from 3 lines of code to entire research magazines.

我将概述最常见的此类技术及其结果。

I will outline the most common such techniques and their results.

一个最简单的&最快的方法。几十年前作为寻找图片相似性的手段。这个想法是,一个森林会有很多绿色,一个人的脸很多粉红色,或什么。所以,如果你比较两张图片与森林,你会得到一些直方图之间的相似性,因为你有很多绿色。

One of the simplest & fastest methods. Proposed decades ago as a means to find picture simmilarities. The idea is that a forest will have a lot of green, and a human face a lot of pink, or whatever. So, if you compare two pictures with forests, you'll get some simmilarity between histograms, because you have a lot of green in both.


下载:太简单了。香蕉和海滩看起来一样,因为两者都是黄色的。

Downside: it is too simplistic. A banana and a beach will look the same, as both are yellow.

OpenCV方法:compareHist()

OpenCV method: compareHist()



模板匹配



这是一个很好的例子, matchTemplate找到了很好的匹配。它将搜索图像与正在搜索的图像进行卷积。它通常用于在较大的图像中找到较小的图像部分。

Template matching

A good example here matchTemplate finding good match. It convolves the search image with the one being search into. It is usually used to find smaller image parts in a bigger one.


缺点:它只会返回相同的图像,相同的大小&

OpenCV方法:matchTemplate()

Downsides: It only returns good results with identical images, same size & orientation.
OpenCV method: matchTemplate()



功能匹配



被认为是进行图像搜索的最有效的方法之一。从图像中提取多个特征,以确保即使旋转/缩放/倾斜也将再次识别相同特征的方式。以这种方式提取的特征可以与其他图像特征集匹配。在第一个特征中具有高比例的特征的另一图像最可能描绘相同的对象/场景。它可以用于找到图片之间拍摄角度的相对差异,或重叠量。

Feature matching

Considered one of the most efficient ways to do image search. A number of features are extracted from an image, in a way that guarantees the same features will be recognized again even it is rotated/scaled/skewed. The features extracted this way can be matched against other image feature sets. Another image that has a high proportion of the features in the first one is most probably depicting the same object/scene. It can be used to find the relative difference in shooting angle between pics, or the amount of overlapping.


有许多OpenCV教程/样本,以及一个精彩视频此处。一个完整的OpenCV模块(features2d)专用于它。

缺点:它可能很慢。

There are a number of OpenCV tutorials/samples on this, and a nice video here. A whole OpenCV module (features2d) is dedicated to it.
Downsides: It may be slow. It is not perfect.




  • 您可以在这里找到更详细的信息和其他类似的技术: http://answers.opencv.org/question/877/ how-to-match-2-hog-for-object-detection /#882

    • You can find more detailed info and other similar techniques here: http://answers.opencv.org/question/877/how-to-match-2-hog-for-object-detection/#882
    • 这篇关于检查图像与OpenCV的相似性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆