edu.wpi.cscore

## Class CvSource

- java.lang.Object
- - edu.wpi.cscore.VideoSource
  - - edu.wpi.cscore.CvSource

-     public class CvSource
      extends VideoSource

  A source that represents a video camera.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class edu.wpi.cscore.VideoSource

      `VideoSource.Kind`

  - ### Field Summary

    - ### Fields inherited from class edu.wpi.cscore.VideoSource

      `m_handle`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CvSource(java.lang.String name, VideoMode.PixelFormat pixelFormat, int width, int height, int fps)` Create an OpenCV source.
    `CvSource(java.lang.String name, VideoMode mode)` Create an OpenCV source.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `VideoProperty` | `createBooleanProperty(java.lang.String name, boolean defaultValue, boolean value)`
    `VideoProperty` | `createIntegerProperty(java.lang.String name, int minimum, int maximum, int step, int defaultValue, int value)`
    `VideoProperty` | `createProperty(java.lang.String name, VideoProperty.Kind kind, int minimum, int maximum, int step, int defaultValue, int value)` Create a property.
    `VideoProperty` | `createStringProperty(java.lang.String name, java.lang.String value)`
    `void` | `notifyError(java.lang.String msg)` Signal sinks that an error has occurred.
    `void` | `putFrame(Mat image)` Put an OpenCV image and notify sinks.
    `void` | `setConnected(boolean connected)` Set source connection status.
    `void` | `setDescription(java.lang.String description)` Set source description.
    `void` | `SetEnumPropertyChoices(VideoProperty property, java.lang.String[] choices)` Configure enum property choices.

    - ### Methods inherited from class edu.wpi.cscore.VideoSource

      `enumerateProperties, enumerateSinks, enumerateSources, enumerateVideoModes, equals, free, getDescription, getHandle, getKind, getKindFromInt, getLastFrameTime, getName, getProperty, getVideoMode, hashCode, isConnected, isValid, setFPS, setPixelFormat, setResolution, setVideoMode, setVideoMode`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CvSource

          public CvSource(java.lang.String name,
                          VideoMode mode)

      Create an OpenCV source.
      Parameters:
        `name` - Source name (arbitrary unique identifier)
        `mode` - Video mode being generated

    - #### CvSource

          public CvSource(java.lang.String name,
                          VideoMode.PixelFormat pixelFormat,
                          int width,
                          int height,
                          int fps)

      Create an OpenCV source.
      Parameters:
        `name` - Source name (arbitrary unique identifier)
        `pixelFormat` - Pixel format
        `width` - width
        `height` - height
        `fps` - fps

  - ### Method Detail

    - #### putFrame

          public void putFrame(Mat image)

      Put an OpenCV image and notify sinks. Only 8-bit single-channel or 3-channel (with BGR channel order) images are supported. If the format, depth or channel order is different, use Mat.convertTo() and/or cvtColor() to convert it first.
      Parameters:
        `image` - OpenCV image

    - #### notifyError

          public void notifyError(java.lang.String msg)

      Signal sinks that an error has occurred. This should be called instead of NotifyFrame when an error occurs.

    - #### setConnected

          public void setConnected(boolean connected)

      Set source connection status. Defaults to true.
      Parameters:
        `connected` - True for connected, false for disconnected

    - #### setDescription

          public void setDescription(java.lang.String description)

      Set source description.
      Parameters:
        `description` - Description

    - #### createProperty

          public VideoProperty createProperty(java.lang.String name,
                                              VideoProperty.Kind kind,
                                              int minimum,
                                              int maximum,
                                              int step,
                                              int defaultValue,
                                              int value)

      Create a property.
      Parameters:
        `name` - Property name
        `kind` - Property kind
        `minimum` - Minimum value
        `maximum` - Maximum value
        `step` - Step value
        `defaultValue` - Default value
        `value` - Current value
      Returns:
        Property

    - #### createIntegerProperty

          public VideoProperty createIntegerProperty(java.lang.String name,
                                                     int minimum,
                                                     int maximum,
                                                     int step,
                                                     int defaultValue,
                                                     int value)

    - #### createBooleanProperty

          public VideoProperty createBooleanProperty(java.lang.String name,
                                                     boolean defaultValue,
                                                     boolean value)

    - #### createStringProperty

          public VideoProperty createStringProperty(java.lang.String name,
                                                    java.lang.String value)

    - #### SetEnumPropertyChoices

          public void SetEnumPropertyChoices(VideoProperty property,
                                             java.lang.String[] choices)

      Configure enum property choices.
      Parameters:
        `property` - Property
        `choices` - Choices