Package edu.wpi.first.cscore
Class CvSource
java.lang.Object
edu.wpi.first.cscore.VideoSource
edu.wpi.first.cscore.ImageSource
edu.wpi.first.cscore.CvSource
- All Implemented Interfaces:
AutoCloseable
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.wpi.first.cscore.VideoSource
VideoSource.ConnectionStrategy, VideoSource.Kind
-
Field Summary
Fields inherited from class edu.wpi.first.cscore.VideoSource
m_handle
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Put an OpenCV image and notify sinksvoid
putFrame
(Mat image, PixelFormat format, boolean skipVerification) Put an OpenCV image and notify sinks.Methods inherited from class edu.wpi.first.cscore.ImageSource
createBooleanProperty, createIntegerProperty, createProperty, createStringProperty, notifyError, setConnected, setDescription, setEnumPropertyChoices
Methods inherited from class edu.wpi.first.cscore.VideoSource
close, enumerateProperties, enumerateSinks, enumerateSources, enumerateVideoModes, equals, getActualDataRate, getActualFPS, getConfigJson, getDescription, getHandle, getKind, getKindFromInt, getLastFrameTime, getName, getProperty, getVideoMode, hashCode, isConnected, isEnabled, isValid, setConfigJson, setConnectionStrategy, setFPS, setPixelFormat, setResolution, setVideoMode, setVideoMode
-
Constructor Details
-
CvSource
Create an OpenCV source.- Parameters:
name
- Source name (arbitrary unique identifier)mode
- Video mode being generated
-
CvSource
Create an OpenCV source.- Parameters:
name
- Source name (arbitrary unique identifier)pixelFormat
- Pixel formatwidth
- widthheight
- heightfps
- fps
-
-
Method Details
-
putFrame
Put an OpenCV image and notify sinksThe image format is guessed from the number of channels. The channel mapping is as follows. 1: kGray 2: kYUYV 3: BGR 4: BGRA Any other channel numbers will throw an error. If your image is an in alternate format, use the overload that takes a PixelFormat.
- Parameters:
image
- OpenCV Image
-
putFrame
Put an OpenCV image and notify sinks.The format of the Mat must match the PixelFormat. You will corrupt memory if they dont. With skipVerification false, we will verify the number of channels matches the pixel format. If skipVerification is true, this step is skipped and is passed straight through.
- Parameters:
image
- OpenCV imageformat
- The pixel format of the imageskipVerification
- skip verifying pixel format
-