Qt World Summit: Register Today!

Camera + overlay

  • Hi,

    I need to set up a simple android app where some simple 2D graphics (say a bunch of lines and circles) will be overlayed on top of a camera viewfinder in real time. I need to be able to analyze the viewfinder image in realtime and overlay my graphics in realtime as well. Please advise what classes to look at. I would prefer not to use QML/Quick if the "pure" Qt suffices. There is no need for any complex GUI or fluid effects with bells and whistles.

    Thanks for any thoughts, I am new to mobile applications with Qt.

  • Moderators

    the last time I used the pure -c++ variant- of QCamera, I had serious trouble to get it to work in mobile(android, was fine on ios) but it has been 4 or 5 releases since than, so it might be fine now. Or you have to use QML to get access to the camera - that was what I used in the end.

    That said, you want to look into the QCamera to access the hardware camera and QVideoProbe for accessing the frames the camera delivers.

  • @J-Hilk thanks for a hint. Well, I am torn indeed between pure Qt or Quick for my purpose. I am reluctant to learn QML (that I do not know) but if this is what works better/more solid then I can adopt. Can anyone else please share their thoughts what is the best (stable, reliable, supported) way of using camera for my purpose?

    Thanks a lot, Dominik

  • Moderators

    @Domel07 there is no reason, not to mix and match as you see fit.

    Most QML applications end up with a c++ backend, for example to analyze a frame/picture

    Or you can use for example a QQuickView or QQuickWidgets to simply load a QML-Camera file. You can query that file on c++ side for the camera object and use it as if it were any other c++ object.
    The QuickView/widget does not even have to be visible for your purpose.

  • @J.Hilk thank you, will try to follow along those lines. Thanks!

  • @Domel07 you may want to take a look at this post, as it shows how to integrate QML, Android and OpenCV.

    I need to be able to analyze the viewfinder image in realtime

    What tool(s) are you planning to use for that?

  • @Pablo-J.-Rogina Exactly OpenCV :) But am happy to first get the backbones running, i.e. doing some trivial computations myself and drawing some lines/circles over camera viewfinder in realtime (think tracking a moving object or detecting oval shapes).

    Thank you!

Log in to reply