如何在opencv中的相机流上叠加小动画 [英] How to overlay small animation on camera stream in opencv
问题描述
我正在使用opencv作为我的大学项目开发一个应用程序,它几乎完成了,除了我无法在摄像机流上覆盖动画视频(Flash视频),我想要捕获用户的嘴并且在检测到嘴之后我想要覆盖烟雾的动画视频.有人可以帮我叠加一下吗?如果不可能的话,您能否阐明任何解决方法
I am developing an application using opencv as my college project, it's almost done except that i am unable to overlay a animated video( a flash video) over my camera stream, i want to capture user mouth and after detecting mouth i want to overlay a animated video of smoke. Please can anyone help me with the overlaying part? If it is not possible can you shed some light on any workaround
我正在使用opencv 2.3.1和ubuntu 11.10.
I am using opencv 2.3.1 and ubuntu 11.10.
推荐答案
基本上,您需要做的就是在视频帧中设置 ROI (感兴趣的区域),然后执行以下操作:将任意图像复制到视频帧中的特定位置.
Basically, all you need to do is set a ROI (Region of Interested) in the video frame and then perform the operation to copy an arbitrary image to that specific position in the video frame.
I've demonstrated how to do something similar in this thread, where the user selects the ROI with the mouse and the system performs a grayscale conversion of that area.
此外,此线程显示了如何使用鼠标在网络摄像头窗口上方绘制.
Also, this thread shows how to use the mouse to draw over the webcam window.
两个线程都使用OpenCV的C接口,它们显示了如何实现所需的叠加效果.
Both threads use the C interface of OpenCV and they show how to accomplish the overlay effect you are looking for.
这篇关于如何在opencv中的相机流上叠加小动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!