Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved QAbstractVideoSurface camera frames brightness

    General and Desktop
    1
    2
    288
    Loading More Posts
    • 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.
    • T
      tomatoketchup last edited by tomatoketchup

      Hi everyone,

      I implemented a QAbstractVideoSurface, and a widget to be painted based on this example.
      Everything works fine, but the camera preview I get is very dark compared to the result I get when I use a QCameraViewfinder or QVideoWidget.
      Here's the code I am using to create the QCamera:

      m_camera = new QCamera(this);
      
      connect(m_camera, &QCamera::statusChanged, this, &MainWindow::cameraStatusChanged);
      
      m_camera->load();
      m_camera->setViewfinder(ui->videoWidget->videoSurface()); // videoSurface is a QAbstractVideoSurface
      

      And here's the slot 'cameraStatusChanged':

      void MainWindow::cameraStatusChanged(QCamera::Status status)
      {
          if(status == QCamera::LoadedStatus)
          {
              m_cameraLoaded = true;
      
              QCameraImageProcessing *imgProcessing = m_camera->imageProcessing();
      
              if(imgProcessing->isAvailable())
              {
                  qDebug() << "image processing available";
                  imgProcessing->setBrightness(1.0);
                  imgProcessing->setSaturation(1.0);
              }
          }
          else if(status == QCamera::UnloadedStatus)
          {
              m_cameraLoaded = false;
          }
      }
      

      Unfortunately, the brightness and the other filters (like the saturation) don't work and the preview video is still dark.

      How can I change the brightness of my video frames?
      Do I need to implement my own QVideoWidget and a QPainterVideoSurface (which is undocumented) ?
      Thank you in advance.

      EDIT: Is there a way to adjust the brightness automatically, as the QVideoWidget does?

      1 Reply Last reply Reply Quote 0
      • T
        tomatoketchup last edited by

        For those who implemented a QAbstractVideoSurface: didn't anyone have that problem?

        1 Reply Last reply Reply Quote 0
        • First post
          Last post