Search code examples
androidandroid-camera

Take pictures in a loop without stopping


How do I take pictures in a loop without stopping? Can I do that without planting the phone?

The idea is to take pictures to extract the image brightness level when I'm filming with Android camera.


Solution

  • Technically you can have a loop of the Camera's takePicture and have the Camera.PictureCallBack analyze the brightness. This will bog down your Android phone unfortunately unless you potentially call the takePicture in an interval(i.e every 10 seconds).

    You did mention filming though, do you possibly want to use the preview frames instead to analyze? The preview frame is the frame that is being shown on your device screen, not the frame that is captured by the hardware at your specified resolution. If the resolution is not the problem, you could set the Camera.PreviewCallback() for the Camera object and have the PreviewCallBack analyze each frame for brightness. These frames are already being generated by the Android system and pushed to your application so no extra cost in resources.

    http://developer.android.com/reference/android/hardware/Camera.html#setPreviewCallback(android.hardware.Camera.PreviewCallback)