如何在另一个图像中找到一个图像? [英] How to find one image inside of another?

查看:69
本文介绍了如何在另一个图像中找到一个图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 2 个 bmp 图像.ImageA 是截图(示例)ImageB 是其中的一个子集.比如说,一个图标.

I have 2 bmp images. ImageA is a screenshot (example) ImageB is a subset of that. Say for example, an icon.

我想在 ImageA 中找到 ImageB 的 X、Y 坐标(如果存在).

I want to find the X,Y coordinates of ImageB within ImageA (if it exists).

知道我该怎么做吗?

推荐答案

  1. 那么 ImageA 中的 ImageB 是否有任何变形?
  2. 图像的精确度"如何,例如,在逐个像素时,它们将相同?
  3. 您有多少计算能力?

如果前两个问题的答案是 NoYes,那么您的问题很简单.了解Q3的答案也很有帮助.

If the answers to the first two questions are No and Yes, then you have a simple problem. It also helps to know the answer to Q3.

更新:

基本思想是这样的:不是将 imageB 中每个像素周围的窗口与 imageA 中的每个像素匹配并检查相关性,而是让我们确定两个图像中的兴趣点(或特征),这些点将可跟踪.所以看起来角落真的是可追踪的,因为它周围的区域有点相似(不详述) - 因此,让我们在两个图像中找到一些真正的角落,并搜索看起来最相似的角落.

The basic idea's this: instead of matching a window around every pixel in imageB with every pixel in imageA and checking the correlation, let's identify points of interest (or features) in both images which will be trackable. So it looks like corners are really trackable since the area around it is kinda similar (not going into details) - hence, let's find some really strong corners in both images and search for corners which look most similar.

这减少了用 A 搜索 B 中的每个像素的问题,例如,搜索 B 中的 500 个角和 A 中的 1000 个角(或类似的东西) - 快得多.

This reduces the problem of searching every pixel in B with A to searching for, say, 500 corners in B with a 1000 corners in A (or something like that) - much faster.

最棒的是,您可以在 OpenCV.如果您不觉得使用 emguCV (C# varriant),请使用 FAST 检测器可以找到匹配的角点,从而在图像之间定位多个特征.完成后,您可以找到图像左上角的位置.

And the awesome thing is you have several such corner detectors at your disposal in OpenCV. If you don't feel using emguCV (C# varriant), then use the FAST detector to find matching corners and thus locate multiple features between your images. Once you have that, you can find the location of the top-left corner of the image.

这篇关于如何在另一个图像中找到一个图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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