Android camera2 判断相机功能是否可控的实例
android camera2 可调功能适配
首先获取到设备等级:
float hardwarelevel = mcameracharacteristics.get(cameracharacteristics.info_supported_hardware_level);
legacy < limited < full < level_3. 越靠右边权限越大
•info_supported_hardware_level_legacy = 2
•info_supported_hardware_level_limited = 0
•info_supported_hardware_level_full = 1
•info_supported_hardware_level_3 = 3
在相应的等级下面会有各自支持的功能,legacy为最低权限
在limited中
additional capabilities may optionally be supported by a limited-level device, and can be checked for in *android.request.availablecapabilities*.
android.request.availablecapabilities
介绍:list of capabilities that this camera device advertises as fully supporting.
int[] ints = mcameracharacteristics.get(cameracharacteristics.request_available_capabilities);
possible values:
•backward_compatible
•manual_sensor
•manual_post_processing
•raw
•private_reprocessing
•read_sensor_settings
•burst_capture
•yuv_reprocessing
•depth_output
•constrained_high_speed_video
for example manual_semsor:request_available_capabilities_manual_sensor the camera device can be manually controlled (3a algorithms such as auto-exposure, and auto-focus can be bypassed). the camera device supports basic manual control of the sensor image acquisition related stages. this means the following controls are guaranteed to be supported: manual frame duration control - android.sensor.frameduration - android.sensor.info.maxframeduration manual exposure control - android.sensor.exposuretime - android.sensor.info.exposuretimerange manual sensitivity control - android.sensor.sensitivity - android.sensor.info.sensitivityrange manual lens control (if the lens is adjustable) - android.lens.* manual flash control (if a flash unit is present) - android.flash.* manual black level locking - android.blacklevel.lock auto exposure lock - android.control.aelock
这些值对应的特征值举例:
final string name3 = capturerequest.sensor_frame_duration.getname();
name3 -》android.sensor.frameduration
列出这个的意思是,如果想知道该设备是否支持此功能,可以通过getname()获取其包名,然后在
mcameracharacteristics.getavailablecapturerequestkeys();生成的队列中寻找。
如果有匹配则是可控;
capturerequest.lens_focus_distance;调节焦距
capturerequest.control_af_mode;自动对焦模式
capturerequest.sensor_sensitivity 调节iso
capturerequest.control_ae_mode 自动曝光模式
以上这篇android camera2 判断相机功能是否可控的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。