Android Camera2 RAW streaming

Viewed 4995

I am very new to Android and trying to:

  • Stream raw data from the camera (ImageFormat RAW_SENSOR)
  • Process raw data
  • Display processed results interactively

It seems like raw data capture is only available in still capture mode. Is this correct ?

If so would it be possible to perform repeated CaptureRequests for RAW images instead ? What kind of performance can be expected using a 13MP sensor ? Any reference code ?

Many thanks in advance,

Guillaume

EDIT:

Here is what I have done so far:

  • Create preview capture that renders to SurfaceTexture
  • Frame rate is calculated / updated in onSurfaceTextureUpdated()

    Questions:

    • Is it OK to calculate framerate in onSurfaceTextureUpdated() ?
    • I tried to set different dimensions to texture.setDefaultBufferSize() but it has no effect on framerate. Is this normal ?
  • Add raw ImageReader's surface to cameraDevice.createCaptureSession()

  • Add callback to cameraCaptureSessions.setRepeatingRequest()
  • In callback's onCaptureCompleted(), added a captureRawImage() call every N frames.
  • captureRawImage() creates a still image capture.
  • add setOnImageAvailableListener() to raw ImageReader to do something useful with raw image.

The raw resolution is 4208x3120

Minimum frame duration is 33ms

Stall duration is 200ms

The framerate I get for only preview is about 25-30 fps.

The framerate I get when I preview and enable raw capture every frame is about 15 fps.

I get some "ImageReader_JNI: Unable to acquire a buffer item, very likely client tried to acquire more than maxImages buffers" message, even if I do raw capture every 100 frames.

I would love to get some feedback on:

  • Whether this is a proper way to do what I want to do.
  • How I could switch to burst capture rather than still image every N frame, if it would be more efficient.
  • Whether these initial numbers make sense.

Many thanks,

Guillaume

1 Answers
Related