【发布时间】:2017-08-06 00:29:28
【问题描述】:
由于 this 没有明确的答案,并且 stackoverflow 没有关于 Camera 2 API Gamma 的问题/答案,我要求使用Android Camera 2 API 修改亮度、对比度和 Gamma 的解决方案。
我获取 range 和 step 的代码:
Rational controlAECompensationStep = characteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_STEP);
if (controlAECompensationStep != null) {
compensationStep = controlAECompensationStep.doubleValue();
}
Range<Integer> controlAECompensationRange = characteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE);
if (controlAECompensationRange != null) {
minCompensationRange = controlAECompensationRange.getLower();
maxCompensationRange = controlAECompensationRange.getUpper();
}
我设置亮度百分比的方法:
public void setBrightness(int value) {
int brightness = (int) (minCompensationRange + (maxCompensationRange - minCompensationRange) * (value / 100f));
previewRequestBuilder.set(CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION, brightness);
applySettings();
}
private void applySettings() {
try {
captureSession.setRepeatingRequest(previewRequestBuilder.build(), null, null);
} catch (Exception e) {
e.printStackTrace();
}
}
但是这种方法不能正常工作。图片变成green,就像here。
我描述了我在 documentation 中找到的所有内容(包括演示 .apk)。
【问题讨论】:
-
你可以试试 Spectaculum,它适用于 Camera2 API:github.com/protyposis/…
-
@UmairAdil 感谢您的回复。但这不是我真正想要的。
-
@VladimirKulyk 我已经在 Nexus 5x 设备和 B+ 上安装了 apk,B- 工作正常。没有绿色?
-
@AnuragSingh ok :D 如果手动更改 B、G 或 C,我将
AutoWhiteBalance设置为false。它使我的预览变成绿色。 -
对不起,我没明白。如果您需要更新apk,请这样做?
标签: android android-camera android-camera2