如何将视频显示为 ARToolKit 检测到的标记上的叠加层?
我正在使用 ARToolKit 开发一个基于环境中二维标记检测的 iOS 增强现实应用程序。我希望能够在这些标记上叠加视频,但我不知道如何做到这一点。
如何使用 ARToolKit 将视频叠加在实时摄像头输入中的特定标记上?
I'm using ARToolKit to develop an iOS augmented reality application based on the detection of 2-D markers in the environment. I'd like to be able to overlay video on these markers, but I'm not sure how to do this.
How would I use ARToolKit to overlay video on specific markers within a live camera feed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ARToolKit for iOS(来自 ARToolworks)自版本 4(2011 年 8 月发布)以来就包含了电影叠加的示例。该示例称为 ARAppMovie。
ARToolKit for iOS (from ARToolworks) includes an example of movie overlay since release 4 (released August 2011). The example is called ARAppMovie.
Benjamin Loulier 有一个示例 VRToolKit 应用程序,他在其中使用 ARToolKitPlus(派生自 ARToolKit)使用 iPhone 摄像头跟踪标记,然后将 3D 对象放置在其上。他围绕 ARToolKit 的标记识别代码创建了一个包装器,该包装器提供了模型视图矩阵的回调,该模型视图矩阵对有关场景中该标记的位置和方向的信息进行了编码。
您可以做类似的事情,只是不像他那样覆盖 CAEAGLLayer,您可以将视频放置在标准 CALayer 中并转换该图层以匹配场景中对象的旋转和放置。学习他的代码(受 GPL 保护,因此您可能无法直接使用它),您应该能够将视频覆盖在场景上,而不需要您自己的大量代码。
Benjamin Loulier has a sample VRToolKit application where he uses ARToolKitPlus (derived from ARToolKit) to use the iPhone camera to track markers, then place 3-D objects over them. He created a wrapper around ARToolKit's marker recognition code that provides a callback with the model view matrix that encodes information about position and orientation of this marker in the scene.
You could do something similar, only instead of overlaying a CAEAGLLayer like he does, you could place your video within a standard CALayer and transform that layer to match the rotation and placement of the object within the scene. Learning from his code (which is under GPL, so you probably can't use it directly), you should be able to overlay your video on the scene without requiring a lot of code of your own.