Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to set a configuration specific to a certain USB camera?
Qt 6.11 is out! See what's new in the release blog

How to set a configuration specific to a certain USB camera?

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 3 Posters 3.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sorut
    wrote on last edited by
    #1

    Hi everyone,

    currently I'm developing a little tool, which simply takes the images of two webcams and displays them. Development takes place under Win 10, with an option to later port it to Android. The capture and display stuff works. So far so good. Setting frame rate and resolution works. Also access to image processing stuff.

    The problem is now, that the QCamera object doesn't give me access to exposure and focus related settings (isAvailable() == false). I tried to figure out, how to implement it myself but I totally got lost in the nearly non existing documentation to service provider, plugins, control interfaces, requestControll(), n'stuff (or I used the wrong search patterns).
    Until now I even couldn't figure out, how to get a handle to the camera device itself, to simply send some raw data configuration bytes. Which would be sufficient enough and also platform independent.
    After browsing the Qt source code, it seemed, that the hardware specific stuff/access is always hidden in classes private sections inside special classes. Like QCameraPrivat, QMediaObjectPrivate, DSCameraSession and so on.

    Is there a way, to do some device specific configuration stuff? Without the need to re implement a whole bunch of interfaces to fit inside the QT multimedia stack?

    If someone could point me to the right documentation/tutorials or a working example? This would be really really great.

    Greetings
    Sorut

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi and welcome to the forums
      Did you try this class ?
      http://doc.qt.io/qt-5/qcameraexposurecontrol.html#details

      S 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi and welcome to the forums
        Did you try this class ?
        http://doc.qt.io/qt-5/qcameraexposurecontrol.html#details

        S Offline
        S Offline
        Sorut
        wrote on last edited by
        #3

        @mrjj Yes, I tried this way also (via camera->service->requestControl(...). Same result: not available.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Not all backends provide all the controls. You have to check whether Direct Show provides the ones you want.

          Or do you have some API for the camera you are using ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          S 1 Reply Last reply
          2
          • SGaistS SGaist

            Hi,

            Not all backends provide all the controls. You have to check whether Direct Show provides the ones you want.

            Or do you have some API for the camera you are using ?

            S Offline
            S Offline
            Sorut
            wrote on last edited by
            #5

            @SGaist Yes, the cameras have an API, which I need to use. Like switching the image transfer mode from RAW to compressed, or do some adjusting during zoom and so on. I know for sure, that the cameras work. They are already used this way with the old main application (written in C#).

            After some additional Qt source browsing, I've got the impression that adding additional QMediaControl functionality is impossible without altering the existing driver (read patching the Qt source code).
            Under Windows the relevant part is buried inside private member m_session (holding a DSCameraSession *) of DSCameraService. DSCameraService itself is only a wrapper which returns different control objects. ... To be honest, I don't get the advantage of this design decision at all. Why this paranoid hiding/encapsulation without the possibility to add custom control(s)?

            Probably it is the best way to simply get rid of this and do it all manually without the hassle of the multimedia stack.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              It's not paranoïa.

              AFAIK, the design of QtMultimedia stack is to provide a common wrapper to access the platform specific multimedia API in a uniform manner while, at the same time, it provides you the means to also implement your own plugins if you have something custom like it seems you do.

              If your camera provider gives you all the means to access configuration options, video streams and what not, then I'd recommend implementing your own QCamera backend.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              S 1 Reply Last reply
              1
              • SGaistS SGaist

                It's not paranoïa.

                AFAIK, the design of QtMultimedia stack is to provide a common wrapper to access the platform specific multimedia API in a uniform manner while, at the same time, it provides you the means to also implement your own plugins if you have something custom like it seems you do.

                If your camera provider gives you all the means to access configuration options, video streams and what not, then I'd recommend implementing your own QCamera backend.

                S Offline
                S Offline
                Sorut
                wrote on last edited by
                #7

                @SGaist You are right about this. I hoped to prevent the complete re implementation of my one camera driver only to add some configuration switches.

                Is there a tutorial/documentation about implementing a qt service provider (which is the camera driver?). The qt documentation itself is ... a little to compact about this topic.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  Sorut
                  wrote on last edited by
                  #8

                  Never mind. For now, we decided to ignore the multimedia stack and implement the camera driver more directly. Maybe a qt integration comes later.

                  Thanks for all your help.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    No there's not.

                    I've based the various backend I wrote on the existing ones which basically makes the plugin a "wrapper" to use the various SDK needed.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    S 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      No there's not.

                      I've based the various backend I wrote on the existing ones which basically makes the plugin a "wrapper" to use the various SDK needed.

                      S Offline
                      S Offline
                      Sorut
                      wrote on last edited by
                      #10

                      @SGaist That was the idea I started with in the first place. But the device access is hidden inside the privat section of the platform depended implementation. As far as I understood the qt source code.

                      How do re use this part and still get access to the hardware and be able to do custom configuration?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        What do you mean by "device access" ?

                        As for writing a QCamera backend plugin, you don't have to use any private classes.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        1
                        • S Offline
                          S Offline
                          Sorut
                          wrote on last edited by
                          #12

                          I tried to find a way to use the available backend(s) (platform plugins/service provider) and only add a custom device control. The majority of the camera backend functionality simply works for me and is usable. It is only missing some configuration options.
                          But I simply couldn't find a way to add such a custom device control without altering the qt source code itself (or I'm greatly missing something). What I meant with "device access hidden in side the private section".

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            Ok, indeed, if you want to extend one of the plugin you have to modify Qt's sources, but you can limit that to the plugin itself without have to rebuild all of Qt.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved