Android: How to delay the capture of a specific frame shot by the camera?

I am working on a light (LED) communication system using the camera Androidas a receiver, which creates thresholds on the camera frames. To do this, I use the preview callback method onPreviewFrame. To be more precise, it is necessary to delay frame capture every few frames so that the system re-synchronizes.

My questions:

  • How to delay capture (and not preview) of one frame?
  • Is it possible that there are internal fps frame rate changes that I don’t know about, and if so, how can I limit or change them?

* To limit the speed of the fps camera, I use setPreviewFpsRange, setAutoWhiteBalanceLockand setAutoExposureLock.

+4
source share
1 answer

You can try the new android.hardware.camera2 package added to API level 21, which replaces the class of obsolete cameras and provides fine-grained control over the functionality of the camera:

Get CameraManager Service

CameraManager manager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE);

Get a list of cameras available on your device

String[] cameraIdList = manager.getCameraIdList();

Go through CameraList to select a camera with the desired characteristics.

for(String cameraId:cameraIdList)
{
    CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
}

Create a camera callback class with preview requests and still capture

private class CameraCallback extends CameraDevice.StateCallback
{
    @Override
    public void onOpened(CameraDevice camera)
    {
        CaptureRequest previewRequest = camera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW).build();

        CaptureRequest stillCaptureRequest = camera.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE).build();
    }
}
0
source

All Articles