版权声明:本文使用https://creativecommons.org/licenses/by-nc-nd/4.0/规定的《署名-非商业性使用-禁止演绎 4.0 国际》协议 https://blog.csdn.net/bluewindtalker/article/details/79999172
本篇文章即为通过一系列的方法获得当前摄像头所处环境的亮度,最相近的就是微信的扫一扫提示“轻触照亮”打开手电筒的功能,首先我们看一个方法setPreviewFormat方法,在注释中我们可以清楚的看到默认使用NV21格式,
/**
* Sets the image format for preview pictures.
*
If this is never called, the default format will be
* {@link android.graphics.ImageFormat#NV21}, which
* uses the NV21 encoding format.
*
* 此处省略部分内容
*
* @param pixel_format the desired preview picture format, defined by
* one of the {@link android.graphics.ImageFormat} constants. (E.g.,
* ImageFormat.NV21 (default), or
* ImageFormat.YV12)
*
* @see android.graphics.ImageFormat
* @see android.hardware.Camera.Parameters#getSupportedPreviewForm