QAbstractVideoSurface camera frames brightness



  • 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?



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.