android - Camerax 如何将自动白平衡锁定设置为 true,extender.setCaptureRequestOption 不起作用
问题描述
我正在尝试在 camerax 中实现自动白平衡锁定,但我遇到了一种情况。当我想将自动白平衡锁定设置为真并拍照时,我的照片只有黑色。我正在为此工作很长时间。有什么我错过的吗?
这是我使用扩展器设置camerax属性的方法:
注意:自动曝光锁定正在工作。
private void setExtender(Camera2Interop.Extender<?> extender) {
/* if exposure compensation set before it sets compensation value, if not sets auto exposure */
if (mIsSetExposureCompensation) {
camera.getCameraControl().setExposureCompensationIndex(exposureCompensation);
extender.setCaptureRequestOption(CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION, exposureCompensation);
}
// when setExposureCompensation is true then getAutoExposureLock will return true
extender.setCaptureRequestOption(CaptureRequest.CONTROL_AE_LOCK, getAutoExposureLock());
/* sets auto white balance */
extender.setCaptureRequestOption(CaptureRequest.CONTROL_AWB_MODE, CaptureRequest.CONTROL_AWB_MODE_AUTO);
extender.setCaptureRequestOption(CaptureRequest.CONTROL_AWB_LOCK, getAutoWhiteBalanceLock());
}
解决方案
推荐阅读
- python - 块大小没有给出预期的输出
- python - 如何测试调用缺少模块的python类?
- python - 有没有办法确保创建一组目录,而不必声明路径?
- python - 在 tf.distribute.MirroredStrategy 中使用 model.fit() 时出现断言错误
- powershell - PowerShell 是否支持 HashTable 序列化?
- javascript - 使动画通过页面css
- ios - AirPods 的 AVAudioSession .playAndRecord 低音量问题
- c# - 无法使用 EF Core 执行带有命名和输出参数的 SQL Server SP
- django - ValueError:“图像”属性没有与之关联的文件
- java - 使用 Spring Boot 解析管道分隔文件