[Interest] QVideoProbe in QML?

Jason H scorp1us at yahoo.com
Thu Feb 6 19:47:18 CET 2014


Awesome. I can probably figure out the QML stuff, but the pixel conversion was giving my nightmares.



________________________________
 From: Tr3wory <tr3w at freemail.hu>
To: Interests Qt <interest at qt-project.org> 
Sent: Thursday, February 6, 2014 11:34 AM
Subject: Re: [Interest] QVideoProbe in QML?
 

LOL, I didn't find that class, so I wrote one for my own little more
than a week ago:
http://lists.qt-project.org/pipermail/interest/2014-January/010992.html

I believe no QML class exist with the same functionality (fix me if
I'm wrong, looks like I'm not good at finding classes :) ), so you
need to do it in C++.

I can help you more with the conversion part, I did it like this:

// frame is originally const QVideoFrame&, but the map function is not const
QVideoFrame nonConstFrame(frame);  // shallow copy
nonConstFrame.map(QAbstractVideoBuffer::ReadOnly);

QImage::Format format =
QVideoFrame::imageFormatFromPixelFormat(nonConstFrame.pixelFormat());
QImage image = QImage(nonConstFrame.bits(), nonConstFrame.width(),
nonConstFrame.height(), nonConstFrame.bytesPerLine(),format).copy();

nonConstFrame.unmap();

Tr3w

On Thu, Feb 6, 2014 at 3:49 PM, Jason H <scorp1us at yahoo.com> wrote:
> I have a QML project (Lin/Android) that I need to scan bar codes using the
> camera or video playback (for testing).
>
> I found the QVideoProbe class. But not sure how to use it in QML. I have a
> C++ class that will do the bar code recognition, it takes a QImage or QUrl
> of an image. The reader works with images, so that part works.
>
> But how do I assemble all this, and important convert from a QVideoFrame to
> a QImage?
>
> I would want to do something like:
> {
> Camera {}
> Text {} // barcode display
> BarCodeReader { onBarCode: text.text =  barcode }
> VideoProbe: { source: camera; onFrame: barcodeReader.read(frame)
> }
>
>
> Thanks!
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

>
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140206/3a379449/attachment.html>


More information about the Interest mailing list