Coding Chase - Projects

My 3D Hub

Thank You For Donating:

Ikeeki (linux-sunxi@irc.freenode.net)
Computer Troubleshooters Brasil

Tuesday, 25 March 2014

Qt5 on Embedded - USB Webcams

Well, so by now Qt5 graphics on Cubieboard devices are pretty much stable and displaying solid performance - so what now?

Last year I did some research on Qt5, GStreamer and Raspberry Pi. Back then, I was using a Raspberry Pi, an old USB Webcam, an IR Sensor and a bright white LED.

Some coding magic with QZXing and a short while later I had a nifty QRCode Decoding app, running on Raspberry Pi:

- the sensor would be triggered by placing a card against an acrylic plate
- the app would use the webcam to snap a picture
- the app would analyse the picture with QZXing and decode any existing QRCode within
- the decoded string would be passed on from the C++ layer worker thread, to the main event loop and the QML layer - to update a Text element.
- as an added bonus, I included the snapped picture on QML and I also added a LED later on to act as flash to ensure proper lighting when the picture was snapped.

I recently uploaded the code to my bitbucket account, back then I had to modify QXZing to work with Qt 5 since it was 4.7.

While this proof of concept worked, Qt was relying on an external command - streamer - using QProcess - and I always thought of going back and integrating the webcam in Qt, the proper way. Also, the Pi's CPU was getting some load with the whole thing.

Fast forward it to today and with cubieboard's performance, and even a conventional dual core SoC has the potential to improve the experience.

I've managed to produce new development environments for Cubieboard A20 (sd card images and cross-compiled qmake for the dev host) where Qt5, by the means of QtMultimedia, has GStreamer integration, these are being uploaded to the cubieforums hosting solution

While GStreamer on Cubie isn't (yet) hardware accelerated, for this specific case, it works - my old USB webcam works fine either on Framebuffer or X11, and since it supports MJPEG, I get 30 FPS @640x480 with medium/low CPU stress.

Hopefully I'll be able to update the QRDecoder example to include proper USB Webcam handling, rather than rely on streamer.

Later on I'll also try to integrate an NFC shield I never got to use - let's see how that one goes...!

No comments :

Post a Comment