How to set the sensor gain and exposure in streaming mode

I understand sensor gain and exposure couldn’t be modified during streaming. But how can I set them without reset everything? Following are some steps I took.

Scenario 1 (single capture) works fine:

  1. Create CameraProvider
  2. Get `CameraDevice
  3. Create CaptureSession
  4. Create Request
  5. Create OutputStreamSettings
  6. Set output stream settings, such as pixel format, resolution
  7. Create OutputStream
  8. Create FrameConsumer
  9. Enable OutputStream
  10. Get SourceSettings
  11. Set GainRange and ExposureTimeRange
  12. Start single capture iCaptureSession->capture(request.get())
  13. Get the frame iFrameConsumer->acquireFrame()
  14. Reset all pointers and done.

Scenario 2 (streaming with everything torn down) works fine:

  1. Same steps in scenario 1 until step 11 (set gain and exposure)
  2. Change gain and exposure ranges
  3. Create event queue
  4. Send repeat request iCaptureSession->repeat(request.get())
  5. Start a thread to wait for events and acquire frames
  6. Stop the capture iCaptureSession->stopRepeat() and iCaptureSession->waitForIdle()
  7. Reset all pointers, such as output stream, request, frame consumer and etc.
  8. Repeat above steps with different gain and exposure ranges.

Scenario 3 (streaming without tearing down everything) doesn’t work:

  1. Same steps in scenario 1 until step 11 (set gain and exposure)
  2. Change gain and exposure ranges
  3. Create event queue
  4. Send repeat request iCaptureSession->repeat(request.get())
  5. Start a thread to wait for events and acquire frames
  6. Stop the capture iCaptureSession->stopRepeat() and iCaptureSession->waitForIdle()
  7. Repeat above steps from 2 to 6 with different gain and exposure ranges

In scenario 3, it doesn’t seem to actually change the gain and exposure. May I ask what I missed or make it wrong? How can I change the gain and exposure without resetting all pointers?

Never mind. The setting did take effect. Just my internal frame buffer was not cleared and old frames were still there.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.