Qt World Summit: Register Today!

Android camera frames are only accessible through OpenGL textures, but how?

  • Camera frames are potentially available by subclassing QAbstractVideoSurface and passing that to the camera's setViewfinder() method. When you start the camera, QVideoFrames are passed to the surface's present() method. Well, as long as that method references the frames handle, which seems to be needed to trigger the next frame.

    On Android (Nexus 7) the returned frame type is UserHandle + 1, and the handle is a QVariant that is a list of two QVariants, a UInt and a Matrix4x4. I suspect (see QTBUG-34888) the UInt is an OpenGL texture ID and from QTBUG-35416 I learn "Currently, camera frames are only accessible through OpenGL textures."

    As I am not familiar with OpenGL, can anyone please enlighten me as to

    Is it possible for me to get the frame data from the texture ID using QOpenGLFFunctions or somesuch or is it only available to the QT runtime support?

    If possible, can you outline how I might get the raw frame data please?


Log in to reply