Class CvSource

  • All Implemented Interfaces:
    AutoCloseable

    public class CvSource
    extends VideoSource
    A source that represents a video camera.
    • 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
      • notifyError

        public void notifyError​(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​(String description)
        Set source description.
        Parameters:
        description - Description
      • createProperty

        public VideoProperty createProperty​(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​(String name,
                                                   int minimum,
                                                   int maximum,
                                                   int step,
                                                   int defaultValue,
                                                   int value)
        Create an integer property.
        Parameters:
        name - Property name
        minimum - Minimum value
        maximum - Maximum value
        step - Step value
        defaultValue - Default value
        value - Current value
        Returns:
        Property
      • createBooleanProperty

        public VideoProperty createBooleanProperty​(String name,
                                                   boolean defaultValue,
                                                   boolean value)
        Create a boolean property.
        Parameters:
        name - Property name
        defaultValue - Default value
        value - Current value
        Returns:
        Property
      • createStringProperty

        public VideoProperty createStringProperty​(String name,
                                                  String value)
        Create a string property.
        Parameters:
        name - Property name
        value - Current value
        Returns:
        Property
      • setEnumPropertyChoices

        public void setEnumPropertyChoices​(VideoProperty property,
                                           String[] choices)
        Configure enum property choices.
        Parameters:
        property - Property
        choices - Choices
      • SetEnumPropertyChoices

        @Deprecated
        public void SetEnumPropertyChoices​(VideoProperty property,
                                           String[] choices)
        Deprecated.
        Use setEnumPropertyChoices instead.
        Configure enum property choices.
        Parameters:
        property - Property
        choices - Choices