java - how can i get EXPOSURE TIME when i take picture using camera2?
问题描述
Hello I use android camera 2 and I want to get the exposure time when my picture is saved without Exif interface.
It's possible to get this value ? How do that ?
I try many time but the result is 0
There is my code:
public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
super.onCaptureCompleted(session, request, result);
Toast.makeText(MainActivity.this, "Saved "+file, Toast.LENGTH_SHORT).show();
Log.d(TAG, String.valueOf(result.get(CaptureRequest.SENSOR_EXPOSURE_TIME)));
createCameraPreview();
}
I put this code on captureComplete I think it's the best place to get this value.
thanks!
解决方案
您需要使用CaptureResult
而不是CaptureRequest
. 您可以在下面的示例中看到如何:
public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
super.onCaptureCompleted(session, request, result);
Toast.makeText(MainActivity.this, "Saved "+file, Toast.LENGTH_SHORT).show();
Log.d(TAG, String.valueOf(result.get(CaptureResult.SENSOR_EXPOSURE_TIME)));
createCameraPreview();
}
推荐阅读
- java - java.lang.NoSuchFieldError: 仅当在 Tomcat 上运行时才使用实例
- c# - 用 ADO.NET 经典命令替换 CommandBuilder
- python - 列表列表中的重复项
- security - 功能标志对授权/权限有用吗?
- go - 创建一个全局二维切片,长度为输入
- c# - 覆盖 QRCode 的默认操作
- javascript - 将任意数量的可能具有共享元素的数组合并到一个考虑这些共享元素的嵌套字典对象中?
- python - 带有外键的 Django 过滤字段
- javascript - 从 PPTX 或 ODF 读取基本对象属性
- roslyn - C# 源代码生成器正在分析的程序集的文件路径