Package edu.wpi.cscore
Class CvSource
- java.lang.Object
-
- edu.wpi.cscore.VideoSource
-
- edu.wpi.cscore.CvSource
-
- All Implemented Interfaces:
AutoCloseable
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.ConnectionStrategy, VideoSource.Kind
-
-
Field Summary
-
Fields inherited from class edu.wpi.cscore.VideoSource
m_handle
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description VideoPropertycreateBooleanProperty(String name, boolean defaultValue, boolean value)Create a boolean property.VideoPropertycreateIntegerProperty(String name, int minimum, int maximum, int step, int defaultValue, int value)Create an integer property.VideoPropertycreateProperty(String name, VideoProperty.Kind kind, int minimum, int maximum, int step, int defaultValue, int value)Create a property.VideoPropertycreateStringProperty(String name, String value)Create a string property.voidnotifyError(String msg)Signal sinks that an error has occurred.voidputFrame(Mat image)Put an OpenCV image and notify sinks.voidsetConnected(boolean connected)Set source connection status.voidsetDescription(String description)Set source description.voidsetEnumPropertyChoices(VideoProperty property, String[] choices)Configure enum property choices.voidSetEnumPropertyChoices(VideoProperty property, String[] choices)Deprecated.UsesetEnumPropertyChoicesinstead.-
Methods inherited from class edu.wpi.cscore.VideoSource
close, enumerateProperties, enumerateSinks, enumerateSources, enumerateVideoModes, equals, free, getActualDataRate, getActualFPS, getConfigJson, getDescription, getHandle, getKind, getKindFromInt, getLastFrameTime, getName, getProperty, getVideoMode, hashCode, isConnected, isEnabled, isValid, setConfigJson, setConnectionStrategy, setFPS, setPixelFormat, setResolution, setVideoMode, setVideoMode
-
-
-
-
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 formatwidth- widthheight- heightfps- 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 namekind- Property kindminimum- Minimum valuemaximum- Maximum valuestep- Step valuedefaultValue- Default valuevalue- 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 nameminimum- Minimum valuemaximum- Maximum valuestep- Step valuedefaultValue- Default valuevalue- Current value- Returns:
- Property
-
createBooleanProperty
public VideoProperty createBooleanProperty(String name, boolean defaultValue, boolean value)
Create a boolean property.- Parameters:
name- Property namedefaultValue- Default valuevalue- Current value- Returns:
- Property
-
createStringProperty
public VideoProperty createStringProperty(String name, String value)
Create a string property.- Parameters:
name- Property namevalue- Current value- Returns:
- Property
-
setEnumPropertyChoices
public void setEnumPropertyChoices(VideoProperty property, String[] choices)
Configure enum property choices.- Parameters:
property- Propertychoices- Choices
-
SetEnumPropertyChoices
@Deprecated public void SetEnumPropertyChoices(VideoProperty property, String[] choices)
Deprecated.UsesetEnumPropertyChoicesinstead.Configure enum property choices.- Parameters:
property- Propertychoices- Choices
-
-