vb.net 比较两个图像以检查它们是否相同
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19440001/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Compare two images to check if they are the same
提问by
Which is the efficient way to compare two images (Bitmaps), to check if they are the same or not?
比较两个图像(位图)以检查它们是否相同的有效方法是什么?
I've tried to document me and I've read that I need to re-size both images to around 16x16px, but I don't get the expected result.
我试图记录我,我读到我需要将两个图像的大小重新调整为 16x16 像素左右,但我没有得到预期的结果。
I've tried to compare the resized images using .Equals:
我尝试使用 .Equals 比较调整后的图像:
If img1.Equals(img2) then
msgbox("are equals!")
End if
I've seen AForgeimage library but I can't found any method inside to compare Images.
我看过AForge图像库,但在里面找不到任何方法来比较图像。
Is there way to do an efficient Image comparison using .NET classes or 3rd party libs without hardcode a pixel-per-pixel image comparer? If not, any example of a function to compare images?
有没有办法使用 .NET 类或 3rd 方库进行有效的图像比较,而无需硬编码逐像素图像比较器?如果没有,有没有比较图像的函数的例子?
采纳答案by Paul
You need to think carefully about your requirements and what equal means. If you are doing a direct pixel by pixel comparison, then you can find numerous .net image classes to help with this (I am not a .net expert but try here Image Comparison for find percentage of similarity between images)
您需要仔细考虑您的要求以及平等的含义。如果您正在逐个像素地进行直接比较,那么您可以找到许多 .net 图像类来帮助解决此问题(我不是 .net 专家,但请在此处尝试图像比较以查找图像之间的相似度百分比)
Of course implementing a simple direct image difference is fairly easy. You could even allow for slight differences with difference < threshold, which the tutorial in the above SO answer discusses. Incidentally this answer also mentions SIFT, which I did not realize until after I had mentioned it. SIFT is a good tool depending on your requirements.
当然,实现简单的直接图像差异相当容易。您甚至可以允许差异 < 阈值的细微差异,上述 SO 答案中的教程对此进行了讨论。顺便说一句,这个答案还提到了 SIFT,直到我提到它之后我才意识到。根据您的要求,SIFT 是一个很好的工具。
The SIFT 3rd party tool is a great way to compare images that can have slight variations, but you might have to make a system call as I am not sure if they provide a .net interface. The definitive website for SIFT implementation is: http://www.cs.ubc.ca/~lowe/keypoints/
SIFT 3rd 方工具是比较可能有轻微变化的图像的好方法,但您可能需要进行系统调用,因为我不确定它们是否提供 .net 接口。SIFT 实施的权威网站是:http: //www.cs.ubc.ca/~lowe/keypoints/
I did find this on the internet: http://www.nowozin.net/sebastian/tu-berlin-2006/libsift/which claims to be a c# implementation.
我确实在互联网上找到了这个:http: //www.nowozin.net/sebastian/tu-berlin-2006/libsift/声称是 ac# 实现。

