本讲是android camera专题系列的第24讲,我们介绍android camera2 api专题的vendortag实战。
更多资源:
资源 | 描述 |
---|---|
在线课程 | |
知识星球 | 星球名称:深入浅出android camera 星球id: 17296815 |
极客笔记圈 |
什么是vendortag
vendortag是oem/手机厂商自定义的metadata key
三种类型
- static(描述能力)
-
control(设置请求)
-
dynamic(实际生效)
操作vendortag
步骤
- 定义key
-
确认数据类型
-
调用get/set方法
实战
- 判断画面中是否有物体在移动
@suppresslint("newapi")
public static final cameracharacteristics.key mvendortag_facelandmark_availableids =
new cameracharacteristics.key<>(
"com.google.pixel.experimental2018.facelandmark.availableids",
byte[].class);
@suppresslint("newapi")
public static final capturerequest.key mvendortag_motion_detection_enable =
new capturerequest.key<>(
"com.google.pixel.experimental2017.stats.motion_detection_enable",
byte.class);
@suppresslint("newapi")
public static final captureresult.key mvendortag_camera_motion_x =
new captureresult.key<>(
"com.google.pixel.experimental2017.stats.camera_motion_x",
float.class);
@suppresslint("newapi")
public static final captureresult.key mvendortag_camera_motion_y =
new captureresult.key<>(
"com.google.pixel.experimental2017.stats.camera_motion_y",
float.class);
@suppresslint("newapi")
public static final captureresult.key mvendortag_subject_motion =
new captureresult.key<>(
"com.google.pixel.experimental2017.stats.subject_motion",
float.class);