Qt-interest Archive, May 2008
Capture video from Webcam
Message 1 in thread
Hi.
I have a C++ source code that captures the frames of a webcam. Also, I have
a function that returns the adress of the buffer where the frames are saved.
Now, I need to show the webcam video but I don't know that widget to use
(QLabel(image), Phonon::VideoPlayer, QImage, ...). What I do to show video
from the webcam? I use Qt 4.4 for Linux.
Thanks in advance.
--
[ signature omitted ]
Message 2 in thread
Hi,
Joan Carles Jimenez wrote:
> I have a C++ source code that captures the frames of a webcam. Also, I have
> a function that returns the adress of the buffer where the frames are saved.
> Now, I need to show the webcam video but I don't know that widget to use
> (QLabel(image), Phonon::VideoPlayer, QImage, ...). What I do to show video
> from the webcam? I use Qt 4.4 for Linux.
The easiest way to get something on screen to to ensure your data is in
the correct format, place it into a QImage and then paint to e.g. a QLabel.
What the performance is like depends... :-)
Tim
----------------------------------------------------------------------
dr. t. dewhirst [t] +44 (0)1738 450 465
director [w] www.bugless.co.uk
bugless software development ltd.
[a] algo business centre, glenearn road, perth, PH2 0NJ
--
[ signature omitted ]
Message 3 in thread
On Fri, May 16, 2008 at 11:35 AM, Tim Dewhirst <tim@xxxxxxxxxxxxx> wrote:
> The easiest way to get something on screen to to ensure your data is in the
> correct format, place it into a QImage and then paint to e.g. a QLabel.
>
> What the performance is like depends... :-)
This tactic gave very good performance with Qt 4.1 and 4.3 on Windows.
--
[ signature omitted ]
Message 4 in thread
Hi,
Doesn't the documentation of your code document the formatting of the data
in your buffer? If it does, and it matches one of the pre-defined data
formats in QImage (see QImage::Format enum), you can use QImage::QImage(
const uchar * data, int width, int height, int bytesPerLine, Format format )
to construct a QImage based on the existing buffer.
Again: it may not be the fastest solution ever, especially if you want a
moving image, but it should work for making static shots for instance.
HTH,
André
"Joan Carles Jimenez" <jjcarles@xxxxxxxx> schreef in bericht
news:200805161725.09648.jjcarles@xxxxxxxxxxx
> Hi.
>
> I have a C++ source code that captures the frames of a webcam. Also, I
> have
> a function that returns the adress of the buffer where the frames are
> saved.
> Now, I need to show the webcam video but I don't know that widget to use
> (QLabel(image), Phonon::VideoPlayer, QImage, ...). What I do to show video
> from the webcam? I use Qt 4.4 for Linux.
>
> Thanks in advance.
>
> --
> Joan Carles Jimenez
> jjcarles@xxxxxxxx
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 5 in thread
On Friday 16 May 2008 18:47:29 André Somers wrote:
> it may not be the fastest solution ever, especially if you want a
> moving image, but it should work for making static shots for instance.
I need to show a moving image. What would be the fastest solution?
Thanks.
--
[ signature omitted ]
Message 6 in thread
Hi,
Joan Carles Jimenez wrote:
> On Friday 16 May 2008 18:47:29 André Somers wrote:
>> it may not be the fastest solution ever, especially if you want a
>> moving image, but it should work for making static shots for instance.
>
> I need to show a moving image. What would be the fastest solution?
It depends on the platform and the size of the image (and the refresh
rate). Try it and see. I would suspect that for windows or linux (X11)
you'll be fine; OS X maybe not...
Tim
----------------------------------------------------------------------
dr. t. dewhirst [t] +44 (0)1738 450 465
director [w] www.bugless.co.uk
bugless software development ltd.
[a] algo business centre, glenearn road, perth, PH2 0NJ
--
[ signature omitted ]