← Back to team overview

qreator-discuss team mailing list archive

Qreator gets decoding support

 

Sort of :)

As per the blueprint [1] drafted last week, I've been making progress on
adding the decoding feature from images coming from a device's camera.

As of today, Qreator Touch has gained decoding support (yay!), with some
caveats described below.

I've been researching both the C++ and JavaScript ways of accessing the QR
decoding library (ZXing), and I thought I'd share some notes along the way.

# Requirements

To try this on a desktop, the libqt5multimedia5-plugins package needs to be
installed for the webcam to work. It essentially contains the GStreamer
bindings for the Qt camera backend. Just do a:

    sudo apt-get install libqt5multimedia5-plugins

# C++ QR decoding plugin

This is now working and available as a package on the experimental PPA [2].
Just add the PPA and install the package to try:

    sudo add-apt-repository ppa:qreator-hackers/qreator-experimental
    sudo apt-get install qt5declarative-qzxing-plugin

The code working with the C++ plugin is revision 15 on this branch [3]

I've added an ARM build, so that it can also be installed on mobile devices.

Decoding works with it on the desktop, but for some reason I could not get
it to work on a device. It seemed that the signals to start and finish
decoding are never emitted on the device, but I haven't investigated in
much depth yet why.

It currently passes an image captured from QML to the C++ plugin. It could
work better if we could pass the preview directly without passing through
the file system, something that used to be possible in Qt 4, but experts
have told me it's not in Qt 5. I've still got some hopes someone can answer
this question [4] for an alternative way of doing it.

# JavaScript decoding plugin

Thanks to Stuart Langridge I could also get the JavaScript decoder to work
with QML. No additional packages are required.

Decoding works well, but it's extremely slow: it takes about 30 seconds for
the code to be decoded, but I have the suspicion that the delay lies
somewhere else than in the JavaScript decoder.

The code working with the JavaScript version is revision 16 on this branch
[3]

# Caveats

- The decoding is flaky at best, so this should be considered as a tech
preview at this point. In particular:
  - On desktop: images captured are way darker than the video preview, so
only captures during the day with sunlight seem to work.
  - On mobile devices: C++ plugin does not emit signals, so no decoding.
JavaScript version is extremely slow (see above)
- On a Galaxy Nexus the orientation of the camera seems to be rotated 90
degrees. I saw a related comment on the Touch camera app and a workaround,
but I'll have to look at the code in more detail
- The camera video preview should be improved (we need to think about
things such as device orientation and how to use the full size of the
screen). I'd also like to add a square frame or markers to indicate the
area of capture for the QR code.
- The workflow for showing and saving decoded codes needs to be defined

In any case, it's been quite exciting to get decoding working, even on a
limited set of cases, and this should provide the basis to now actually get
it to work :)

Cheers,
David.

[1] https://blueprints.launchpad.net/qreator/+spec/qreator-as-decoder
[2] https://launchpad.net/~qreator-hackers/+archive/qreator-experimental
[3] https://code.launchpad.net/~dpm/qreator/touch-scanner
[4]
http://askubuntu.com/questions/302774/how-to-pass-the-image-preview-from-the-qml-camera-component-to-a-c-plugin