public interface CameraCaptureSession
CameraCaptureSession
provides the means by which streaming data can be captured
from the camera.Modifier and Type | Interface and Description |
---|---|
static interface |
CameraCaptureSession.CaptureCallback
A callback object for tracking the progress of a
CameraCaptureRequest submitted to the
camera device. |
static interface |
CameraCaptureSession.StateCallback
A callback object for receiving updates about the state of a camera capture session.
|
static class |
CameraCaptureSession.StateCallbackDefault |
static interface |
CameraCaptureSession.StatusCallback |
Camera getCamera()
void close()
CameraCaptureSequenceId startCapture(CameraCaptureRequest cameraCaptureRequest, CameraCaptureSession.CaptureCallback captureCallback, Continuation<? extends CameraCaptureSession.StatusCallback> statusContinuation) throws CameraException
CameraFrame
s are provided through
CameraCaptureSession.CaptureCallback.onNewFrame(org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureSession, org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureRequest, org.firstinspires.ftc.robotcore.external.hardware.camera.CameraFrame)
as they become available.
With this method, the camera device will continually capture images
using the settings in the provided CameraCaptureRequest
, at the maximum
rate possible.
If the capture fails to start, then an exception is thrown.
To stop the repeating capture, call stopCapture()
Calling this method will replace any earlier repeating request or burst set up by this method.
cameraCaptureRequest
- the request to repeat indefinitelycaptureCallback
- The callback object to notify every time the
request finishes processing.statusContinuation
- the callback to notify regarding status events of the captureCameraCaptureSession.StatusCallback.onCaptureSequenceCompleted(org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureSession, org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureSequenceId, long)
.CameraException
- if the camera device is no longer connected or has
encountered a fatal errorjava.lang.IllegalStateException
- if this session is no longer active, either because the session
was explicitly closed, a new session has been created
or the camera device has been closed.stopCapture()
,
startCapture(CameraCaptureRequest, Continuation, Continuation)
CameraCaptureSequenceId startCapture(CameraCaptureRequest cameraCaptureRequest, Continuation<? extends CameraCaptureSession.CaptureCallback> captureContinuation, Continuation<? extends CameraCaptureSession.StatusCallback> statusContinuation) throws CameraException
startCapture(CameraCaptureRequest, CaptureCallback, Continuation)
, but supports
the generality of a Continuation
to handle the capture. Note that unless this continuation
synchronously dispatches, or indicates that it can run on a guest worker thread, a copy of
each frame will be made before invoking CameraCaptureSession.CaptureCallback.onNewFrame(org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureSession, org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureRequest, org.firstinspires.ftc.robotcore.external.hardware.camera.CameraFrame)
.void stopCapture()
Cancel any ongoing repeating capture set by startCapture(org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureRequest, org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureSession.CaptureCallback, org.firstinspires.ftc.robotcore.external.function.Continuation<? extends org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureSession.StatusCallback>)
. This method
is idempotent.
Any currently in-flight captures will still complete.