我们可以检查列表中是否存在重复的形象? [英] Can we check whether a duplicate image exists in a list?

查看:142
本文介绍了我们可以检查列表中是否存在重复的形象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的图像处理。我的SO问题是...

I am new to image processing. My SO question is...

我拍摄图像使用的摄像头,然后我用这个形象,并检查它针对列表容器。如果列表容器包含看起来像这样图像的图像,然后做一次手术,否则没有。

I take an image using a camera, then I use this image and check it against a list container. If the list container contains an image that looks like this image then do an operation, otherwise don't.

示例...


  1. 我有一个形象img_one

  2. 我的列表中包含image_one,image_two,image_three

  3. 显示列表有image_one(即,它看起来像这样图片)

那么,如何检查这对图像列表中的容器,并显示其图像看起来像这样形象的项目?

So how do I check this image against the items in the list container and show which image looks like this image?

在此先感谢朋友。所有的想法都是AP preciated。

Thanks in advance friends. All ideas are appreciated.

推荐答案

这要看你怎么定义的复制了许多。

It depends a lot on what do you define by "duplicate".

如果您正在寻找完全相同的副本(复制 - 粘贴),游戏很简单。由萨菲尔提出,只有少数性能改进的方法,就可以了。

If you are looking for absolutely identical copies (copy-paste), the game is simple. The approach proposed by Safir, with just a few performance improvements, is Ok.

如果你想找到几乎确切的重复,工作突然变得非常困难。看看这个<一个href=\"http://stackoverflow.com/questions/11541154/checking-images-for-similarity-with-opencv/11541587#11541587\">Checking对于OpenCV的相似图片的更多信息。

If you want to find almost-exact duplicates, the job suddenly becomes incredibly difficult. Check out this Checking images for similarity with OpenCV for more info.

现在,回到简单的方法,这取决于你有多少的图片进行比较。因为一个文件夹中有1000张图像对所有其他每个图像比较给你1.000.000图像读取和比较。 (因为你不能将其全部保存在RAM一次,你将不得不加载和卸载它们一百万次),这样的话实在是太多了,即使一个功能强大的桌面处理器。

Now, back to the "simple" approach, it depends on how many pictures you have to compare. Because comparing each image against all the others in a folder with 1000 images gives you 1.000.000 image reads and comparisons. (Because you cannot store them all in RAM at once, you will have to load and unload them a million times) That way is too much for even a powerful desktop processor.

一个简单的方法是使用一个散列函数(如SHA2)针对每个图像,然后比较只是哈希。一个良好的特设散列的图像可能会直方图(虽然阳性您可能需要使用memcmp仔细检查)。

A simple way would be to use a hashing function (as sha2) for each image, and then compare just the hashes. A good ad-hoc "hashing" for images may be the histogram (although for positives you may want to double-check with memcmp).

和即使您尝试蛮力方法(比较与其他每个图像像素),更快的方法是使用memcmp(),而不是通过访问像素图像的像素。

And even if you try the brute-force approach (comparing each image pixel with the other), a faster way is to use memcmp() instead of accessing images pixel by pixel.

这篇关于我们可以检查列表中是否存在重复的形象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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