第45讲 Android Camera2 API 手动对焦实战

本讲是Android Camera专题系列的第45讲,我们介绍Android Camera2 API专题的手动对焦实战,包括如下内容:

  1. 手动对焦(Manual Focus)

视频在线观看:

加入知识星球与更多Camera同学交流
– 星球名称:深入浅出Android Camera
– 星球ID: 17296815

手动对焦(Manual Focus)

判断手动对焦是否支持

  • LENS_INFO_MINIMUM_FOCUS_DISTANCE是否大于0
  • CameraControllerManager2#printFocusCapability

设置AF Mode为OFF

GeekCamera代码逻辑

PopupView
|--> Preview#updateFocus
|----> Preview#setFocusValue
|------> CameraController2#setFocusValue //更新Focus Mode或Focus Distance
|--------> CameraSettings#setFocusMode
|--------> CameraSettings#setFocusDistance
|------> CameraController2#setRepeatingRequest

调整Focus Distance

ManualFocusSeekbar#onProgressChanged // ManiActivity
|--> Preview#setFocusDistance
|----> CameraController2#setFocusDistance
|------> CameraSettings#setFocusDistance
|------> CameraController2#setRepeatingRequest

setFocusDistance

private void setFocusDistance(CaptureRequest.Builder builder) {
    if( MyDebug.LOG )
        Log.i(TAG, "[AF_Practise] setFocusDistance change focus distance to " + focus_distance);
    builder.set(CaptureRequest.LENS_FOCUS_DISTANCE, focus_distance);
}

赞(0)
未经允许不得转载:极客笔记 » 第45讲 Android Camera2 API 手动对焦实战
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

Android Camera2 API

最新文章