OpenCV Feature Detection and Description -- Understand Feature 理解特征
Posted mraaron
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenCV Feature Detection and Description -- Understand Feature 理解特征相关的知识,希望对你有一定的参考价值。
原文链接 https://docs.opencv.org/4.1.2/df/d54/tutorial_py_features_meaning.html
阅读英文文档开始理解opencv图像识别。有翻译不对的地方,大家指正~谢谢
Goal
In this chapter, we will just try to understand what are features, why are they important, why corners are important etc.
目标:
在这个章节,我们尝试去理解什么是特征,为什么他这么重要,为什么角点(corners)这么重要等等。
Explanation
Most of you will have played the jigsaw puzzle games. You get a lot of small pieces of an image, where you need to assemble them correctly to form a big real image. The question is, how you do it? What about the projecting the same theory to a computer program so that computer can play jigsaw puzzles? If the computer can play jigsaw puzzles, why can‘t we give a lot of real-life images of a good natural scenery to computer and tell it to stitch all those images to a big single image? If the computer can stitch several natural images to one, what about giving a lot of pictures of a building or any structure and tell computer to create a 3D model out of it?
解释:
大多数人都玩过拼图游戏。你有很多的小的图像的碎片,你要把他们正确的拼成一个大的图片。那么问题就是你会怎么做?相同的理论用到计算机程序上,计算机会玩拼图吗?如果计算机会玩拼图,为什么不给计算机很多真实的很好的自然风景,让他拼成一个大的图片?如果计算机可以,那能不能把很多建筑的图像或者一些结构也给计算机让他去构建3D模型呢?
Well, the questions and imaginations continue. But it all depends on the most basic question: How do you play jigsaw puzzles? How do you arrange lots of scrambled image pieces into a big single image? How can you stitch a lot of natural images to a single image?
那么继续,但是这些都是建立在几个基本问题上面的:怎么去玩拼图?怎么整理杂乱的图片变成一张图片的?怎么拼接风景图片变成一张图片的?
The answer is, we are looking for specific patterns or specific features which are unique, can be easily tracked and can be easily compared. If we go for a definition of such a feature, we may find it difficult to express it in words, but we know what they are. If someone asks you to point out one good feature which can be compared across several images, you can point out one. That is why even small children can simply play these games. We search for these features in an image, find them, look for the same features in other images and align them. That‘s it. (In jigsaw puzzle, we look more into continuity of different images). All these abilities are present in us inherently.
答案是,我们正在寻找可以轻松去跟踪去比较的特殊的模式或者说是特殊的特征。如果我们对这种功能进行定义,我们可能会发现很难用语言去表达,但是我们知道这是什么。如果有人让你从一系列图片中指出一个很好的特征的话,你可以做到。这就是为什么一个小孩也可以玩这些游戏的原因。我们在这些图像中寻找的特征,并在其他图像中找到相同的特征并和他们对齐(在拼图游戏中,我们更多的研究了图像的连续性)。这些能力都是我们固有的。
So our one basic question expands to more in number, but becomes more specific. What are these features?. (The answer should be understandable also to a computer.)
因此,我们由一个基本问题扩展到更多,但变得更加具体。这些功能是什么? (答案对于计算机来说也应该是可以被理解的。这里应该是算法吧)
It is difficult to say how humans find these features. This is already programmed in our brain. But if we look deep into some pictures and search for different patterns, we will find something interesting. For example, take below image:
很难描述人类如何发现这些特征。这已经在我们的大脑中进行了编程。但是,如果我们深入研究某些图片并搜索不同的模式,我们会发现一些有趣的东西。例如,拍摄下图:
The image is very simple. At the top of image, six small image patches are given. Question for you is to find the exact location of these patches in the original image. How many correct results can you find?
图像非常简单。在图像的顶部,给出了六个小图像块。问题就是在原始图像中找到这些补丁的确切位置。您可以找到多少正确的结果?
A and B are flat surfaces and they are spread over a lot of area. It is difficult to find the exact location of these patches.
A和B是平坦的表面,它们散布在很多区域上。很难找到这些补丁的确切位置。
C and D are much more simple. They are edges of the building. You can find an approximate location, but exact location is still difficult. This is because the pattern is same everywhere along the edge. At the edge, however, it is different. An edge is therefore better feature compared to flat area, but not good enough (It is good in jigsaw puzzle for comparing continuity of edges).
C和D就简单了。它们是这建筑物的边缘。您可以找到一个大概的位置,但是也很难找出准确的位置。这是因为沿着边缘的每个地方的图案都是相同的。但是,在边缘,情况有所不同。因此,与平坦区域相比,边缘是更好的功能,但不够好(在拼图游戏中比较边缘的连续性很好)。
Finally, E and F are some corners of the building. And they can be easily found. Because at the corners, wherever you move this patch, it will look different. So they can be considered as good features. So now we move into simpler (and widely used image) for better understanding.
最后,E和F是建筑物的某些角落。而且很容易找到它们。因为在拐角处,无论将此修补程序移动到何处,它的外观都将有所不同。因此,它们是很好的特征。因此,现在我们进入更简单(且被广泛使用的图像)以更好地理解。
Just like above, the blue patch is flat area and difficult to find and track. Wherever you move the blue patch it looks the same. The black patch has an edge. If you move it in vertical direction (i.e. along the gradient) it changes. Moved along the edge (parallel to edge), it looks the same. And for red patch, it is a corner. Wherever you move the patch, it looks different, means it is unique. So basically, corners are considered to be good features in an image. (Not just corners, in some cases blobs are considered good features).
就像上面的,蓝色的图块是个平坦的区域,很难被找到和跟踪。无论把它放在哪里,蓝色图块的看起来都一样。黑色图块是个边缘,如果你沿垂直方向移动,就会有变化,如果是平行于图像边缘移动,就没有变化,看上去也是一样的。对于红色图块,这是一个角,无论把它放在哪里,他看上去都是不一样的,就意味着与众不同。所以,基本上,角点被认为是一个很好的特征在图像中。(不仅仅是角点,在一些例子中斑点也是很好的特征)。
**自己的备注:很显然,opencv对于图形特征的描述最初是的介绍里面就说了几个重要的名次:边缘,角点--(移动变化)-->特征,模式**
So now we answered our question, "what are these features?". But next question arises. How do we find them? Or how do we find the corners?. We answered that in an intuitive way, i.e., look for the regions in images which have maximum variation when moved (by a small amount) in all regions around it. This would be projected into computer language in coming chapters. So finding these image features is called Feature Detection.
因此,现在我们回答了我们的问题,“这些功能是什么?”。但是又提出了下一个问题。我们如何找到它们?或者说我们如何找到角点?我们以一种直观的方式回答了这一问题,即寻找图像中在其周围所有区域中移动(少量)变化最大的区域。(果然^_^)在接下来的章节中,这将写入计算机语言中。因此,找到这些图像特征称为特征检测。
We found the features in the images. Once you have found it, you should be able to find the same in the other images. How is this done? We take a region around the feature, we explain it in our own words, like "upper part is blue sky, lower part is region from a building, on that building there is glass etc" and you search for the same area in the other images. Basically, you are describing the feature. Similarly, a computer also should describe the region around the feature so that it can find it in other images. So called description is called Feature Description. Once you have the features and its description, you can find same features in all images and align them, stitch them together or do whatever you want.
我们在图像中找到了特征。一旦你找到它之后,您应该能够在其他图像中找到相同的图像。怎么做?我们围绕该特征采取一个区域(region),用自己的语言解释它,例如“上部是蓝天,下部是建筑物的区域,在建筑物上有玻璃等”,而你会在另一个图片上搜索相同的区域。基本上,您是在描述特征。同样,计算机也应该描述特征周围的区域,以至于它可以在其他图像中找到它。所谓的描述称为特征描述。如果获得特征和它的描述后,您可以在所有图像中找到相同的功能并将它们对齐,拼接它们或做你想要的操作。
So in this module, we are looking to different algorithms in OpenCV to find features, describe them, match them etc.
所以模块中,我们正在寻找不同的算法去发现这些特征,描述它们,匹配它们等。
以上是关于OpenCV Feature Detection and Description -- Understand Feature 理解特征的主要内容,如果未能解决你的问题,请参考以下文章
OpenCV Feature Detection and Description -- Shi-Tomasi Corner Detector
综述:A survey of recent advances in visual feature detection
使用 CSS Capability/Feature Detection 检测 IE11
Feature Pyramid Networks for Object Detection(FPN)-论文阅读笔记
Joint Detection and Identification Feature Learning for Person Search