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 get camera supported resolutions using Qt5?
Forum Updated to NodeBB v4.3 + New Features

How to get camera supported resolutions using Qt5?

Scheduled Pinned Locked Moved General and Desktop
23 Posts 5 Posters 17.2k Views 1 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.
  • X Offline
    X Offline
    xtingray
    wrote on last edited by
    #11

    Testing the same example but this time using Qt 5.3.1 from Linux, same result:

    $ ./camera
    Camera description: "USB2.0 UVC WebCam"
    Camera status: QCamera::LoadedStatus
    CameraBinImageEncoder::supportedResolutions()
    Camera resolution list size: 0

    The method supportedResolutions() always returns an empty list :(


    Qt Developer

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tr3w
      wrote on last edited by
      #12

      Surprisingly I couldn't find a bug report about this (for linux)...
      Now here it is:
      https://bugreports.qt-project.org/browse/QTBUG-40545

      Follow, upvote, comment. Make some noise!

      (There is a bug report for windows, but there it is just not supported...
      https://bugreports.qt-project.org/browse/QTBUG-32743 )

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xtingray
        wrote on last edited by
        #13

        Thanks for the hint... I already voted for it! :)


        Qt Developer

        1 Reply Last reply
        0
        • yeckelY Offline
          yeckelY Offline
          yeckel
          wrote on last edited by
          #14

          It looks like that gstreamer on Linux is not returing any value in: camerabinsession.cpp

          @ GstCaps *supportedCaps = 0;
          g_object_get(G_OBJECT(m_camerabin),
          (mode == QCamera::CaptureStillImage) ?
          SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY : SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY,
          &supportedCaps, NULL);
          if (!supportedCaps)
          return res;@

          I was trying calling gstreamer out of QT and was getting NULL as well. Is it a bug in GStreamer?

          1 Reply Last reply
          0
          • yeckelY Offline
            yeckelY Offline
            yeckel
            wrote on last edited by
            #15

            It looks like that gstreamer on Linux is not returing any value in: camerabinsession.cpp

            @ GstCaps *supportedCaps = 0;
            g_object_get(G_OBJECT(m_camerabin),
            (mode == QCamera::CaptureStillImage) ?
            SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY : SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY,
            &supportedCaps, NULL);
            if (!supportedCaps)
            return res;@

            I was trying calling gstreamer out of QT and was getting NULL as well. Is it a bug in GStreamer?

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

              Hi,

              Either that or the device doesn't return the information. Do you have any other way to retrieve that information on your system ?

              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
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #17

                Hi,

                Either that or the device doesn't return the information. Do you have any other way to retrieve that information on your system ?

                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
                • yeckelY Offline
                  yeckelY Offline
                  yeckel
                  wrote on last edited by
                  #18

                  Well, v4l2 is returning:

                  @$ v4l2-ctl --list-formats-ext
                  ioctl: VIDIOC_ENUM_FMT
                  Index : 0
                  Type : Video Capture
                  Pixel Format: 'YUYV'
                  Name : YUV 4:2:2 (YUYV)
                  Size: Discrete 640x480
                  Interval: Discrete 0.033s (30.000 fps)
                  Interval: Discrete 0.067s (15.000 fps)
                  Size: Discrete 640x360
                  Interval: Discrete 0.033s (30.000 fps)
                  Interval: Discrete 0.067s (15.000 fps)
                  ...@

                  The structure GstCaps *supportedCaps from previous code, has 0 length, but it's valid but @gst_caps_is_any(supportedCaps) == true@

                  1 Reply Last reply
                  0
                  • yeckelY Offline
                    yeckelY Offline
                    yeckel
                    wrote on last edited by
                    #19

                    Well, v4l2 is returning:

                    @$ v4l2-ctl --list-formats-ext
                    ioctl: VIDIOC_ENUM_FMT
                    Index : 0
                    Type : Video Capture
                    Pixel Format: 'YUYV'
                    Name : YUV 4:2:2 (YUYV)
                    Size: Discrete 640x480
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.067s (15.000 fps)
                    Size: Discrete 640x360
                    Interval: Discrete 0.033s (30.000 fps)
                    Interval: Discrete 0.067s (15.000 fps)
                    ...@

                    The structure GstCaps *supportedCaps from previous code, has 0 length, but it's valid but @gst_caps_is_any(supportedCaps) == true@

                    1 Reply Last reply
                    0
                    • yeckelY Offline
                      yeckelY Offline
                      yeckel
                      wrote on last edited by
                      #20

                      I've digged deeper into GStreamer plugin gstcamerabin2.c, here it's querying for pad capabilities @pad = gst_element_get_static_pad (element, padname);

                      caps = gst_pad_query_caps (pad, NULL);@ and then the query failing "GstPAd.html":http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html

                      ...gst_pad_query_caps returns all possible caps a pad can operate with, using the pad's CAPS query function, If the query fails, this function will return filter , if not NULL, otherwise ANY.

                      And this ANY is what's returned into QT and then returned as empty QList. I thing we should use another gstreamer input element aka v4l2src which is stable. Camerabin2 is marked as unstable and under development.

                      1 Reply Last reply
                      0
                      • yeckelY Offline
                        yeckelY Offline
                        yeckel
                        wrote on last edited by
                        #21

                        I've digged deeper into GStreamer plugin gstcamerabin2.c, here it's querying for pad capabilities @pad = gst_element_get_static_pad (element, padname);

                        caps = gst_pad_query_caps (pad, NULL);@ and then the query failing "GstPAd.html":http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html

                        ...gst_pad_query_caps returns all possible caps a pad can operate with, using the pad's CAPS query function, If the query fails, this function will return filter , if not NULL, otherwise ANY.

                        And this ANY is what's returned into QT and then returned as empty QList. I thing we should use another gstreamer input element aka v4l2src which is stable. Camerabin2 is marked as unstable and under development.

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

                          Thanks for sharing your findings !

                          Do you have that with gstreamer0.1 ? Did you check gstreamer 1 ?

                          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
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #23

                            Thanks for sharing your findings !

                            Do you have that with gstreamer0.1 ? Did you check gstreamer 1 ?

                            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