如何修复 Qt5.13.1 中的错误相机?

How can I fix bug camera in Qt5.13.1?

我想调整相机中与曝光相关的设置。 例如,我尝试使用函数 camera.searchAndLock() 但它不起作用。

我尝试运行 Qt 的相机示例,但对于以下代码我总是Unlocked 状态。

switch (m_camera->lockStatus()) {
    case QCamera::Searching:
    case QCamera::Locked:
        m_camera->unlock();
        break;
    case QCamera::Unlocked:
        m_camera->searchAndLock();
    }

我写了下面的QML代码,但是下面的代码总是return unlocking focus.

if (camera.lockStatus == Camera.Unlocked) {
    camera.searchAndLock();
    console.log("searching focus...")                                
   }                                 
   else {                           
        camera.unlock();                        
        console.log("unlocking focus...")                            
     }

我想通过以下代码更改相机中与曝光相关的设置,但它们都不起作用:

camera.searchAndLock()    
camera.exposure.exposureCompensation = value
camera.exposure.spotMeteringPoint.x=value
camera.exposure.spotMeteringPoint.y=value
camera.exposure.manualShutterSpeed = value
camera.exposure.iso  = value
camera.exposure.manualAperture=value

我尝试使用searchAndLock()功能开始对焦,曝光计算,但是在运行之后我的相机的这个功能状态仍然是Unlocked而不是Searching

我能用这个错误做什么? 我可以安装哪个版本的 Qt 没有这个错误?

我通过阅读 link 成功修复了 SerialPort 的错误:

我有办法修复这个错误吗?

Qt 版本:Qt 5.13.1(MSVC 2017,32 位), 平台:Windows10

我想您应该检查一下您的相机是否确实支持任何对焦模式,以及这些模式是什么:

console.debug("supported focus modes: " + focus.supportedFocusModes
                              + ", FocusManual: " + CameraFocus.FocusManual
                              + ", FocusHyperfocal: " + CameraFocus.FocusHyperfocal
                              + ", FocusInfinity: " + CameraFocus.FocusInfinity
                              + ", FocusAuto: " + CameraFocus.FocusAuto
                              + ", FocusContinuous: " + CameraFocus.FocusContinuous
                              + ", FocusMacro: " + CameraFocus.FocusMacro
                              )

通过使用此结果提供的信息,您可以设置适合您的相机硬件的对焦模式。那里有很多不同的硬件,所以在编写应用程序的相机部分时请考虑到这一点。