How to make burst mode available to Camera

前端 未结 2 514
遇见更好的自我
遇见更好的自我 2020-11-30 06:10

I am trying to build a small photo app with a burst mode for camera. The main idea is to shoot a picture every 0,3sec and to store the pictures in an Array until the last pi

相关标签:
2条回答
  • 2020-11-30 06:43

    AFAIK, you cannot take another picture until the first one is complete. Eliminate your for loop and Thread.sleep(). Take the next picture in mPictureCallback.

    The main idea is to shoot a picture every 0,3sec and to store the pictures in an Array until the last picture is taken.

    The "0,3sec" objective is faster than most devices can process an image, and you may not have enough heap space for your array of images. I suspect that you will have to write each image out to disk as it comes in via an AsyncTask, so you can free up the heap space while also not tying up the main application thread.

    0 讨论(0)
  • 2020-11-30 06:54

    You can try capturing subsequent preview frames in preallocated byte arrays. See the following methods:

    http://developer.android.com/reference/android/hardware/Camera.html#addCallbackBuffer(byte[]) http://developer.android.com/reference/android/hardware/Camera.html#setPreviewCallbackWithBuffer(android.hardware.Camera.PreviewCallback)

    ...or http://developer.android.com/reference/android/hardware/Camera.html#setOneShotPreviewCallback(android.hardware.Camera.PreviewCallback) for better control over timing.

    0 讨论(0)
提交回复
热议问题