Class Webcam

java.lang.Object
com.pocolifo.robobase.vision.Webcam
All Implemented Interfaces:
AutoCloseable

public class Webcam extends Object implements AutoCloseable
Abstracts away certain parts of OpenCvCamera.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final com.qualcomm.robotcore.hardware.HardwareMap
    The HardwareMap associated with this webcam.
    final org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName
    The webcam device.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Webcam(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String name)
    Initializes a Webcam.
    Webcam(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName webcamDevice)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Unsets the webcam pipeline; no data will be able to be processed since there is no pipeline active.
    void
    Closes the camera.
    Gets the current active pipeline of the webcam.
    void
    Opens the camera.
    void
    Sets the pipeline for the webcam which can process the data stream coming in from the webcam.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • hardwareMap

      public final com.qualcomm.robotcore.hardware.HardwareMap hardwareMap
      The HardwareMap associated with this webcam.
    • webcamDevice

      public final org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName webcamDevice
      The webcam device.
  • Constructor Details

    • Webcam

      public Webcam(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName webcamDevice)
    • Webcam

      public Webcam(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String name)
      Initializes a Webcam.
      Parameters:
      hardwareMap - The HardwareMap that has the webcam in it.
      name - The name of the webcam in the HardwareMap.
  • Method Details

    • open

      public void open(AbstractResultCvPipeline<?> pipeline) throws RuntimeException
      Opens the camera. For this to be of any use, call setPipeline(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

      public void setPipeline(AbstractResultCvPipeline<?> pipeline)
      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

      public AbstractResultCvPipeline<?> getPipeline()
      Gets the current active pipeline of the webcam.
      Returns:
      The current active pipeline.
    • close

      public void close() throws Exception
      Closes the camera. THIS SHOULD BE CALLED AFTER THE CAMERA IS UNNECESSARY TO THE PROGRAM!
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception - If an error occurred while closing the camera.