Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QCamera, Manual exposure not effective even if available



  • Hello everyone!

    I'm writing a software to perform head tracking using IR LEDs and gyro/accelerometers. To capture the IR LEDs, I've modified a webcam, removing the IR filter and adding a visible light filter. Since the picture is mostly black with only three white spots, autoexposure must be disabled. I can successfully disable autoexposure with other software (I've used this setup for years for head tracking with an other software called FreeTrack), but I can't achieved it with Qt and a QCamera object. My code is the following:

        QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
        foreach (const QCameraInfo &cameraInfo, cameras) {
            qDebug() << cameraInfo.deviceName();
            camera = new QCamera(cameraInfo);
        }
    
        viewfinder = new QCameraViewfinder();
    
        camera->setViewfinder(viewfinder);
        setCentralWidget(viewfinder);
    
        viewfinder->show();
    
        camera->exposure()->setExposureMode(QCameraExposure::ExposureManual);
        camera->exposure()->setManualShutterSpeed(32);   
        camera->start();
    

    I know that right now the iterator is useless but I'm in early testing stage and I only have one webcam connected.

    I have tested that manual exposure is available, and the shutter speed I have set is among the supported ones.
    The strange thing is that if I disable autoexposure from FreeTrack and then run my software, it remains disabled (I guess the webcam retains the settings). If I query the current shutter speed after performing this operation, I get a value of 32. But if I try to run the code above without first using FreeTrack, exposure remains automatic. Moreover, if I enable manual exposure from FreeTrack and then run the code above setting any shutter speed different from 32 (even if among the supported ones) the webcam starts behaving oddly with extremely long shutter speed (in the order of seconds).

    Can anybody help me understand if I'm doing something wrong? It looks like manual exposure is available but somehow I am not able to access it. I have not found many examples of working manual exposure. I have also tested the provided camera example, but I can not access the video settings page.

    Thank you for your help!

    Kind regards,
    Davide


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What OS are you on ?
    What version of Qt are you using ?
    Did you check that the exposure control is available ?


Log in to reply