Class CvSource

  • All Implemented Interfaces:
    AutoCloseable

    public class CvSource
    extends ImageSource
    A source that represents a video camera. These sources require the WPILib OpenCV builds. For an alternate OpenCV, see the documentation how to build your own with RawSource.
    • Constructor Detail

      • CvSource

        public CvSource​(String name,
                        VideoMode mode)
        Create an OpenCV source.
        Parameters:
        name - Source name (arbitrary unique identifier)
        mode - Video mode being generated
      • CvSource

        public CvSource​(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