比较图像找到差异 [英] Compare images to find differences

查看:127
本文介绍了比较图像找到差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任务:我已经安装在我们的组装线,末端的摄像头, 捕获生产的物品的图像。让我们为例说,我们 产生门票(与他们的一些文字和图片)。所以每 生产的门票进行拍照并保存到磁盘映像。现在我 想检查异常,这些保存的图像(即对比 他们的图像(模板),这是行)。所以,如果有一个问题 对我们的装配线的车票(缺少图像,染色,...),我的 应用程序应该找到它(因为它的形象不同于太多我 模板)。

Task: I have a camera mounted on the end of our assembly line, which captures images of produced items. Let's for example say, that we produce tickets (with some text and pictures on them). So every produced ticket is photographed and saved to disk as image. Now I would like to check these saved images for anomalies (i.e. compare them to an image (a template), which is OK). So if there is a problem with a ticket on our assembly line (missing picture, a stain,...), my application should find it (because its image differs too much from my template).

问:什么是比较的图片,并找到最简单的方法 它们之间的区别是什么?我是否需要写我自己的方法,还是可以的我 利用现有的?这将是巨大的,如果我只是设置一个公差值 (即图片可相差为1%),在函数把图像和获得 返回值为true或false:)

Question: What is the easiest way to compare pictures and find differences between them? Do I need to write my own methods, or can I use existing ones? It would be great if I just set a tolerance value (i.e. images can differ for 1%), put both images in a function and get a return value of true or false :)

工具:C#或VB.NET,Emgu.CV(.NET包装OpenCV的),或者类似的东西。

Tools: C# or VB.NET, Emgu.CV (.NET wrapper for OpenCV) or something similar

推荐答案

我建议你看 AForge影像库因为它有很多的它确实有用的功能,这种类型的工作。

I'd recommend looking at AForge Imaging library as it has a lot of really useful functions in it for this type of work.

有,你可以使用多种方法:

There are several methods you could use:

  1. 在简单的减法(模板图像 - 电流),看看有多少像素是不同的。你可能想的阈值的结果,即只包括那些相差10个或更多(例如)像素。
  2. 如果该票可在现场,视动一下,然后1项)是行不通的,除非你可以先找到票。如果实例票是白色的,黑色的背景,你可以做一个阈值图像上,这将使你在哪里的票是个好主意。
  3. 在我之前已经用它的另一种技术是型号查找或模式匹配,但我只知道一个商业库的 Matrox影像库(或MIL),它包含这些功能,因为它们并非微不足道。
  1. Simple subtraction (template image - current) and see how many pixels are different. You'd probably want to threshold the results, i.e. only include pixels that are different by 10 or more (for instance).
  2. If the tickets can move about in the field-of-view then item 1) isn't going to work unless you can locate the ticket first. If for instance the ticket is white on a black background you could do a threshold on the image and that would give you a good idea of where the ticket was.
  3. Another technique I've used it before is "Model Finding" or "Pattern Matching", but I only know of a commercial library Matrox Imaging Library (or MIL) that contains these functions as they aren't trivial.

另外,你需要确保你知道哪些门票的部分更重要。比如我猜想,缺少标识或水印是个大问题。但是,一些地区可能有变量文本,如序列号,所以你希望他们有所不同。基本上,你可能需要从其他人区别对待图像的一些区域。

Also you need to make sure you know which parts of the ticket are more important. For instance I guess that a missing logo or watermark is a big problem. But some areas could have variable text, such as a serial number and so you'd expect them to be different. Basically you might need to treat some areas of the image differently from others.

这篇关于比较图像找到差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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