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 the supported resolution of a QCamera

How to get the supported resolution of a QCamera

Scheduled Pinned Locked Moved Unsolved General and Desktop
qcamera
5 Posts 3 Posters 4.1k Views
  • 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.
  • Andy314A Offline
    Andy314A Offline
    Andy314
    wrote on last edited by Andy314
    #1

    QList<QSize> res = Cam->supportedViewfinderResolutions();
    gives alwas a 0-Length list.
    (Qt 5.6.0 MSVC-2015 - 32 bit)

    Joel BodenmannJ ? 2 Replies Last reply
    0
    • Andy314A Andy314

      QList<QSize> res = Cam->supportedViewfinderResolutions();
      gives alwas a 0-Length list.
      (Qt 5.6.0 MSVC-2015 - 32 bit)

      Joel BodenmannJ Offline
      Joel BodenmannJ Offline
      Joel Bodenmann
      wrote on last edited by Joel Bodenmann
      #2

      Hi,
      I've never used QCamera myself but as nobody replied yet I'll give it a shot...
      The documentation states:

      The camera must be loaded before calling this function, otherwise the returned list is empty.
      

      So, did you load the camera before calling QCamera::supportedViewfinderResolutions() ?

      Industrial process automation software: https://simulton.com
      Embedded Graphics & GUI library: https://ugfx.io

      1 Reply Last reply
      0
      • Andy314A Andy314

        QList<QSize> res = Cam->supportedViewfinderResolutions();
        gives alwas a 0-Length list.
        (Qt 5.6.0 MSVC-2015 - 32 bit)

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @Andy314 Hi! What @Joel-Bodenmann said is correct; you must wait until the camera status has changed to loaded. You can use QCamera::statusChanged signal for this:

        QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
        m_camera = new QCamera(cameras.at(0), this);
        connect(m_camera, &QCamera::statusChanged, this, &MainWindow::onStatusChanged);
        m_camera->load();
        
        // ...
        
        void MainWindow::onStatusChanged()
        {
            qDebug() << m_camera->status();
            qDebug() << m_camera->supportedViewfinderResolutions();
        }
        
        1 Reply Last reply
        1
        • Andy314A Offline
          Andy314A Offline
          Andy314
          wrote on last edited by Andy314
          #4

          Sorry I pasted the the wrong test-code.
          (The supportedViewfinderResolutions() works indeed, but I need the natural camera-resolution.)

          Capture = new QCameraImageCapture(Cam);
          QList<QSize> res = Capture->supportedResolutions();

          List ist empty after loaded signal!!!

          My aim it to retriever the possible resolutions of a camera, choose a possible resolution and make a capture with this resolution.

          If found the code above in the integrated Camera example of the Qt.
          The direct compiled example does not work as well.

          1 Reply Last reply
          0
          • Andy314A Offline
            Andy314A Offline
            Andy314
            wrote on last edited by A Former User
            #5

            I found this link:
            Multimedia Backends
            I seem that in Qt 5.5 (dont know what is with 5.6) for Windows the Camera in not really supported. :-(((
            Any ideas how to integrate camera functionality in a Qt-App ?

            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