python 用opencv和python检测标记

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2608661/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-04 01:03:14  来源:igfitidea点击:

Detect marker with opencv and python

pythonopencvwebcamfeature-detection

提问by Mitch

I am trying to detect a marker in a webcam video feed and overlay it with a 3d object - pretty much exactly like this: http://www.morethantechnical.com/2009/06/28/augmented-reality-with-nyartoolkit-opencv-opengl/

我正在尝试检测网络摄像头视频源中的标记并用 3d 对象覆盖它 - 非常像这样:http: //www.morethantechnical.com/2009/06/28/augmented-reality-with-nyartoolkit- opencv-opengl/

I know artoolkit is the best module for this, but I was hoping to just use opencv in python since I dont know nearly enough c/c++ to be able to use artoolkit. I am hoping someone will be able to get me on the right track towards detecting the marker and determining its location and orientation etc since I have no idea how best to go about this or what functions I should be using.

我知道 atoolkit 是最好的模块,但我希望只在 python 中使用 opencv,因为我不知道足够多的 c/c++ 来使用 atoolkit。我希望有人能够让我走上正确的轨道,以检测标记并确定其位置和方向等,因为我不知道如何最好地进行此操作或我应该使用哪些功能。

回答by Arrix

OpenCV doesn't have marker detection / tracking functionality out of box. However it provides all algorithms needed so it's fairly easy to implement your own one. The article you are referring to uses OpenCV only for video grabbing. The marker detection is done by NyARToolkit which is derived from ARToolkit. NyARToolkit have versions for Java, C# and ActionScript.

OpenCV 没有开箱即用的标记检测/跟踪功能。但是,它提供了所需的所有算法,因此实现您自己的算法相当容易。您所指的文章仅将 OpenCV 用于视频抓取。标记检测由源自 ARToolkit 的 NyARToolkit 完成。NyARToolkit 有 Java、C# 和 ActionScript 版本。

ARToolkit is mostly written in plain C without using fancy C++ features. It's probably easier to use than you thought. The documentation contains well explained tutorials. e.g http://www.hitl.washington.edu/artoolkit/documentation/devstartup.htm

ARToolkit 主要是用纯 C 语言编写的,没有使用花哨的 C++ 功能。它可能比您想象的更容易使用。该文档包含解释良好的教程。例如http://www.hitl.washington.edu/artoolkit/documentation/devstartup.htm

The introductory documentation can help you understand the process of marker detection even if you decide not to use ARToolkit.

即使您决定不使用 ARToolkit,介绍性文档也可以帮助您了解标记检测的过程。

回答by G M

I think the most used way to perform marker detection using python and open CV is to use SURF Descriptors. I have found very useful this videoand the linked code you can find in this page. Here you can download the code. I don't know how to overlay it with a 3d object but I'm sure you can do something with pygame or matplotlib.

我认为使用 python 和开放 CV 执行标记检测的最常用方法是使用 SURF 描述符。我发现这个视频和链接代码非常有用,你可以在这个页面中找到。在这里你可以下载代码。我不知道如何用 3d 对象覆盖它,但我相信你可以用 pygame 或 matplotlib 做一些事情。