Android camera2自定义白平衡

时间:2018-03-21 11:10:14

标签: android colors camera android-camera2

我正在开发一个需要不断输入未经改变的图像的应用程序,因此我设置了一个预览表面来不断捕获图像并对其进行配置,以便我可以手动调整每个控件。

但是,只有这个参数可以逃避我的控制并且它具有色彩校正功能。我使用TEMPLATE_STILL_CAPTURE并按如下方式设置控件:

    captureRequest.set(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_OFF);
    captureRequest.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);
    captureRequest.set(CaptureRequest.CONTROL_AWB_LOCK, true);
    captureRequest.set(CaptureRequest.CONTROL_AWB_MODE, CameraMetadata.CONTROL_AWB_MODE_OFF);
    captureRequest.set(CaptureRequest.CONTROL_AE_LOCK, true);
    captureRequest.set(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CONTROL_AE_MODE_OFF);
    captureRequest.set(CaptureRequest.LENS_FOCUS_DISTANCE, numFocus);
    captureRequest.set(CaptureRequest.NOISE_REDUCTION_MODE, CameraMetadata.NOISE_REDUCTION_MODE_FAST);
    captureRequest.set(CaptureRequest.SENSOR_EXPOSURE_TIME, exposure);
    captureRequest.set(CaptureRequest.SENSOR_SENSITIVITY, sensitivity);
    captureRequest.set(CaptureRequest.TONEMAP_MODE, CameraMetadata.TONEMAP_MODE_CONTRAST_CURVE);
    captureRequest.set(CaptureRequest.TONEMAP_CURVE, tcurve);
    captureRequest.set(CaptureRequest.COLOR_CORRECTION_MODE, CameraMetadata.COLOR_CORRECTION_MODE_TRANSFORM_MATRIX);
    captureRequest.set(CaptureRequest.COLOR_CORRECTION_TRANSFORM, colorTransform);
    captureRequest.set(CaptureRequest.COLOR_CORRECTION_GAINS, rggb);

稍后在CaptureCallback上,当我比较请求和结果时,我发现在结果上,COLOR_CORRECTION_MODE已更改为COLOR_CORRECTION_MODE_FAST。我有什么东西在这里失踪吗?

我使用的是三星Galaxy Tab A 2016(SM-T580),因此有可能它根本不支持它,但我确实不会确认我没有只是做错了。

1 个答案:

答案 0 :(得分:2)

如果设备不支持MANUAL_POST_PROCESSING功能,则不需要支持COLOR_CORRECTION_MODE_TRANSFORM_MATRIX。

FULL硬件级别的所有设备都支持MANUAL_POST_PROCESSING,但有限的设备不支持,LEGACY设备永远不支持它。

因此,请检查可用的功能,以确定您是否可以控制此设备上的色彩校正变换。