Android: detect brightness (amount of light) in phone's surroundings using the camera?

后端 未结 5 986
小蘑菇
小蘑菇 2020-12-01 08:38

The following applies to the Android operating system.

I am trying to estimate how dark (or light) it is in the room where the phone is located using the camera.

5条回答
  •  温柔的废话
    2020-12-01 09:15

    Using the camera is pointless, since the camera will adjust the exposure time and aperture to the surrounding light, so that the recorded images will have very similar overall brightness independent of the actual available light (at least in an ideal world).

    The Android API offer functionality in the SensorManager to access the hardware sensors (you are interested in the sensor of type TYPE_LIGHT). I am not sure however, if you can rely on access to these sensors through the API, although they may (or may not) be present.

提交回复
热议问题