简体   繁体   English

Android Camera2如何在AE_MODE自动设置AE_MODE_OFF后设置ISO感光度值

[英]Android Camera2 how to set ISO sensitivity value after AE_MODE set AE_MODE_OFF automatically

I'm using Camera2 API to modify Camera shutter speed.我正在使用 Camera2 API 来修改相机快门速度。

So I have to set CONTROL_AE_MODE to AE_MODE_OFF .所以我必须将CONTROL_AE_MODE设置为AE_MODE_OFF

Then auto-exposure algorithm will not override SENSOR_SENSITIVITY value.那么自动曝光算法将不会覆盖SENSOR_SENSITIVITY值。

But after shutter speed changed, sensitivity value become not suitable.但改变快门速度后,感光度值变得不合适。 the preview become too dark or white.预览变得太暗或太白。

My question is: How to change SENSOR_SENSITIVITY (ISO value) automatically when AE_MODE is OFF .我的问题是:如何在AE_MODEOFF时自动更改SENSOR_SENSITIVITY (ISO 值)。

I know in iOS camera, they have exposureTargetOffset value to decide whether iso value suitable.我知道在 iOS 相机中,他们有exposureTargetOffset值来决定 iso 值是否合适。

But I have not found in android camera2 api.但是我还没有在android camera2 api中找到。

Any suggestion will be appreciated.任何建议将不胜感激。

The SENSOR_EXPOSURE_TIME and SENSOR_SENSITIVITY can both be changed when AE Mode is off. AE模式关闭时,可以同时更改SENSOR_EXPOSURE_TIMESENSOR_SENSITIVITY The ranges of these settings may vary and can be requested by respectively SENSOR_INFO_EXPOSURE_TIME_RANGE and SENSOR_INFO_SENSITIVITY_RANGE . 这些设置的范围可能会有所不同,可以分别由SENSOR_INFO_EXPOSURE_TIME_RANGESENSOR_INFO_SENSITIVITY_RANGE请求。 Note that this is not possible on all phones! 请注意,这并非在所有手机上都可行!

You can take a look at the Open Camera project as a great example for changing these values. 您可以看一下Open Camera项目,作为更改这些值的一个很好的例子。

There's no semi-automatic mode in camera2 currently; camera2目前没有半自动模式; if you turn off auto-exposure, you have to manually control both exposure and sensitivity. 如果关闭自动曝光,则必须手动控制曝光和感光度。

You can leave AE on, and use exposure compensation to darken/brighten the images instead. 您可以打开自动曝光,并使用曝光补偿使图像变暗/变亮。

In case anyone else wants an answer to this If you're using camera2 API in CameraCaptureSession.CaptureCallback.onCaptureCompleted you can get the current autoexposure time and iso sensitivity.在任何情况下,如果你使用的camera2 API中的人愿意回答这个CameraCaptureSession.CaptureCallback.onCaptureCompleted您可以获得当前自动曝光时间和ISO感光度。 This gets called for every preview frame.每个预览帧都会调用它。 So you can run your preview with auto exposure on, and each time you get a preview frame save exposure multiplied by ISO所以你可以在自动曝光的情况下运行你的预览,每次你得到一个预览帧时,保存曝光乘以 ISO

mExposureTimesISO=(double)(result.get(TotalCaptureResult.SENSOR_SENSITIVITY)*result.get(TotalCaptureResult.SENSOR_EXPOSURE_TIME));

Then in your picture taking call set it to manual exposure, then divide this value by your desired ISO, eg in my ISO 100 locked image capture routine it looks like the below:然后在您的拍照调用中将其设置为手动曝光,然后将此值除以您想要的 ISO,例如在我的 ISO 100 锁定图像捕获例程中,它如下所示:

double exposureAtISO100=mExposureTimesISO/100.0;            
CaptureRequest.Builder build=mCamera.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);

build.set(CaptureRequest.CONTROL_AE_MODE,CaptureRequest.CONTROL_AE_MODE_OFF);
build.set(CaptureRequest.SENSOR_SENSITIVITY,100);
build.set(CaptureRequest.SENSOR_EXPOSURE_TIME,(long)exposureAtISO100);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM