如何同时在不同的 QT 小部件上显示多个视频
我已经编写了一个代码,在不同的 QWidget 上运行不同的 OpenCV 算法..所以我有 3 个选项卡,每个选项卡都应该显示一个摄像头实时流媒体以及它们的处理..我在第一个选项卡小部件处捕获视频并通过它通过对其他选项卡的全局引用...但是我遇到了这个问题,
libv4l1: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl VIDIOCSPICT
尽管我只有一个捕获...
有什么想法吗?
I have done a code which run different algorithms of OpenCV on different QWidgets .. so I have 3 tabs and each should show a camera live streaming with the processing of them .. I take the capture of the video at the first tab widget and pass it by global reference to the other tabs... however I get this problem
libv4l1: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl VIDIOCSPICT
although I have only one capture ..
any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
处理此问题的正确方法是复制相机检索到的帧并将其提供给其他选项卡。 不要共享
捕获
接口!The proper way to handle this issue is copy the frame retrieved by the camera and make it available to the other tabs. Do not share the
capture
interface!我也在使用 OpenCV 和 Qt。为了模拟相机,我使用 Capture 对象从视频文件中读取帧并通过 TCP/IP 发送它们。
为了使您的框架可供所有其他小部件使用,我建议您创建一个继承自 QIODevice 的新类,并初始化您的捕获设备。每次从相机获取新帧时,都将数据保存到 QByteArray 变量中并发出 readRead() 信号。
笔记:
- 所有的小部件都必须连接到readyRead()信号
- 一旦你得到一个新的框架,记得清理以前的数据
- 你必须重新实现函数
virtual qint64 readData( char * data, qint64 maxSize )
才能读取你的数据像这样
I'm also working with OpenCV and Qt. For emulating a camera I'm using the Capture object to read frames from a video file and send them over TCP/IP.
To make your frames available to all the others widgets I suggest to you to create a new class that inherits from QIODevice, initialize your capture device. Every time you get a new frame from the camera, you save the data into a QByteArray variable and emits the readyRead() signal.
Note:
- all your widgets have to be connected to the readyRead() signal
- once you get a new frame, remember to clean previous data
- you have to re-implement function
virtual qint64 readData( char * data, qint64 maxSize )
to be able to read your dataSomething like this