Qt World Summit: Register Today!

Add/set a QCamera device

  • Hello,
    I searched a bit - but the low level interface between QCamera and the actual hardware is not very clear. I have a USB camera that has a libusb based driver library and it is not clear how to use QCamera with this - or if it is even possible.

    Is there documentation on the low level aspects anywhere? I.E., what is a "device", how would one create one and add it to the available devices? How does QCamera currently support/access a camera and what cameras are supported?

    It would be nice to get a conversation going on this - I can imagine that many people are in my position and would like to use the QCamera API but require more clarification on the details of low level implementation. Any input, ideas, leads, links, etc. will be welcome.


  • urgh .. hate to reply to my own post - but I still find the documentation on this a bit obtuse and think it would be nice to have something a bit clearer. Now resorting to reading code and experimentation. Beyond just getting a conversation started I will report findings.

    Which findings at the moment amount to this: QCamera in its default (and perhaps at the moment, only) configuration expects a QMediaService that reads from standard /dev/video output (at least on linux). Eh, yes this is a bit vague still and needs to be confirmed - but it means that if you have, for instance, a webcam that works QCamera will automagically display it. However, if you have a camera not supported in a standard fashion (eg. a Point Grey Chameleon ..) - well, there is work to be done - we'll see what happens with that.

    (to be continued)

  • Hi sidewalk,

    Any progress on this? I have a non-webcam-compatible microscope camera I want to marry to the QCamera qml interface.

  • Lifetime Qt Champion


    You can make you own backend that provides a QCamera service. It's not overly complicated, you'll need to implement the basic control classes that provides:

    • a video renderer
    • a camera device selector (not mandatory but useful)
    • a camera control

    You can take a look at for example the BB10 backend that is pretty complete (it does much more than what you need but it's pretty easy to follow the code)

    Hope it helps

  • OK thanks I will start exploring. I have no experience with the BB10 codebase so any pointers to good starting points would be very helpful.


  • Lifetime Qt Champion

    You can look at the other backends too (they do things in a similar way, it's just that BB10 was one with most of the interfaces implemented when I looked at it).

    It's not the system specifics that will interest you but how the QCamera stuff is implemented. Simply look at the code in the camera folder, this should get you started.

Log in to reply