本讲是Android Camera专题系列的第33讲,我们介绍Android Camera2 API专题的AE自动曝光实战,包括如下内容:
- AE自动曝光流程
- EV控制流程
- AE Lock流程
视频在线观看:
- 极客笔记:极客笔记在线课程
加入知识星球与更多Camera同学交流
– 星球名称:深入浅出Android Camera
– 星球ID: 17296815
GeekCamera2 AE自动曝光流程
回顾GeekCamera2启动流程:第11讲 Android Camera2 API StreamConfigurationMap实战一
Step1: 3A总开关控制
Preview#initCameraParameters
|-->CameraController2#setSceneMode
|-->CameraSettings#setSceneMode
|-->根据当前的scene mode来设置CaptureRequest.CONTROL_MODE
Step2: 设置AE 模式
CameraController2#createPreviewRequest
|--> CameraSettings#setupBuilder
|--> CameraSettings#setAEMode
|-->根据是否自动曝光和Flash状态设置AE Mode
GeekCamera2 EV控制流程
UI上按EV方式展示可调范围
MainActivity#cameraSetup
|--> SeekBar exposure_seek_bar = findViewById(R.id.exposure_seekbar)
|--> exposure_seek_bar.setOnSeekBarChangeListener(null)
|--> exposure_seek_bar.setMax( preview.getMaximumExposure() - min_exposure )
|--> exposure_seek_bar.setProgress( preview.getCurrentExposure() - min_exposure )
|--> exposure_seek_bar.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
调节EV
onProgressChanged
|--> Preview.setExposure
|--> CameraController2.setExposureCompensation
|--> CameraSettings.setExposureCompensation
|--> 设置CONTROL_AE_EXPOSURE_COMPENSATION
|--> showToast(getExposureCompensationString(new_exposure), 0, true)
GeekCamera2 AE Lock流程
MainActivity#clickedExposureLock
|--> Preview#toggleExposureLock
|--> CameraController2#setAutoExposureLock
|--> set CaptureRequest.CONTROL_AE_LOCK value