用Qt显示WebCam视频 [英] Displaying WebCam video with Qt
问题描述
我正在Linux Gnome(Ubuntu 9.04)上使用Qt 4.5(2009.03),并且想在Qt应用程序的Phonon :: VideoWidget中显示由网络摄像头捕获的视频.
I'm using Qt 4.5 (2009.03) on Linux Gnome (Ubuntu 9.04) and would like to display video captured by my webcam in a Phonon::VideoWidget of my Qt application.
我有一个使用v4l2 API的第一个实现,其中我进行了YUV2到RGB的转换,并自己填写了QImage.它运作良好,但效率不是很高.一位同事使用gStreamer来完成相同的操作,而且速度要快得多.
I have a first implementation using the v4l2 API where I do the YUV2 to RGB conversion and fill a QImage my self. It works well but it is not very efficient. A collegue used gStreamer to do the same thing and it was much much faster.
从那时起,我发现了声子,并想使用它.除了绑定到网络摄像头设备作为源外,其他所有内容都已配置和设置.
Since then I found out about phonon and would like to use it. Everything is configured and set up except for the binding to the webcam device as source.
我应该创建一个MediaSource对象,但是我不知道如何配置它.任何帮助都是非常有价值的.
I should create a MediaSource object but I don't know how to configure it. Any help would be greatly valuable.
Phonon概述解释说它不受支持然而.但是我需要一个解决方案.
The Phonon overview explains that it is not supported yet. But I need a solution.
推荐答案
对于这个问题,我知道来得太晚了.但我一直在寻找相同的东西,找不到纯的qt解决方案. 我发现 http://qt-apps.org /content/show.php/Qt+Opencv+webcam+viewer?content=89995 这取决于opencv,我不知道,我也不想学习.
I know its little bit late for this question. but I was looking for the same thing and could not find pure qt solution. I found http://qt-apps.org/content/show.php/Qt+Opencv+webcam+viewer?content=89995 this depends opencv which I dont know and I dont want to learn.
这是我的解决方案 http://qt-apps.org /content/show.php/V4lCapture?content=126541
一件事,它的线程需要再抛光一点,但是它仍然可以工作.
one thing its thread needs to be polished a little more but it works anyway.
这篇关于用Qt显示WebCam视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!