Search code examples
androidcameraandroid-camerasurfaceviewbrightness

How to determine brightness/contrast of a SurfaceView in android?


Im a noob to android development and i want to make a simple camera application that automatically turns on the torch light if the lighting is very dark. I have read through android documentation for a camera method that would allow me to get a lightness/darkness value from the camera, but have been able to find one. I am using a surfaceview to display my camera. Is there some possible way to get a brightness or contrast value from the view in real time? any help is greatly appreciated.


Solution

  • If i understand your question correctly, you need to access the light sensor. Look at this tutorial and it should point you in the right direction