Package com.pocolifo.robobase.vision
Class Webcam
java.lang.Object
com.pocolifo.robobase.vision.Webcam
- All Implemented Interfaces:
AutoCloseable
Abstracts away certain parts of
OpenCvCamera
.-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal com.qualcomm.robotcore.hardware.HardwareMap
TheHardwareMap
associated with this webcam.final org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName
The webcam device. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Unsets the webcam pipeline; no data will be able to be processed since there is no pipeline active.void
close()
Closes the camera.Gets the current active pipeline of the webcam.void
open
(AbstractResultCvPipeline<?> pipeline) Opens the camera.void
setPipeline
(AbstractResultCvPipeline<?> pipeline) Sets the pipeline for the webcam which can process the data stream coming in from the webcam.
-
Field Details
-
hardwareMap
public final com.qualcomm.robotcore.hardware.HardwareMap hardwareMapTheHardwareMap
associated with this webcam. -
webcamDevice
public final org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName webcamDeviceThe webcam device.
-
-
Constructor Details
-
Webcam
public Webcam(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName webcamDevice) -
Webcam
Initializes aWebcam
.- Parameters:
hardwareMap
- TheHardwareMap
that has the webcam in it.name
- The name of the webcam in theHardwareMap
.
-
-
Method Details
-
open
Opens the camera. For this to be of any use, callsetPipeline(AbstractResultCvPipeline)
. Pipelines allow data from the camera to be processed. This is a blocking method. WHEN YOU'RE DONE WITH THE WEBCAM, CLOSE IT!- Parameters:
pipeline
- The initial pipeline which will process camera input.- Throws:
RuntimeException
- If there was an error while opening the camera.
-
setPipeline
Sets the pipeline for the webcam which can process the data stream coming in from the webcam.- Parameters:
pipeline
- The pipeline to use to process data.
-
clearPipeline
public void clearPipeline()Unsets the webcam pipeline; no data will be able to be processed since there is no pipeline active. -
getPipeline
Gets the current active pipeline of the webcam.- Returns:
- The current active pipeline.
-
close
Closes the camera. THIS SHOULD BE CALLED AFTER THE CAMERA IS UNNECESSARY TO THE PROGRAM!- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
- If an error occurred while closing the camera.
-