mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
CvSink: Support grayscale images.
Also support 4-channel BGRx images and provide better error reporting on bad images passed to PutFrame.
This commit is contained in:
@@ -39,6 +39,7 @@ public class CvSink extends VideoSink {
|
||||
}
|
||||
|
||||
/// Wait for the next frame and get the image.
|
||||
/// The provided image will have three 3-bit channels stored in BGR order.
|
||||
/// @return Frame time, or 0 on error (call GetError() to obtain the error
|
||||
/// message);
|
||||
public long grabFrame(Mat image) {
|
||||
|
||||
@@ -29,6 +29,9 @@ public class CvSource extends VideoSource {
|
||||
}
|
||||
|
||||
/// 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.
|
||||
/// @param image OpenCV image
|
||||
public void putFrame(Mat image) {
|
||||
CameraServerJNI.putSourceFrame(m_handle, image.nativeObj);
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.cscore;
|
||||
/// Video mode
|
||||
public class VideoMode {
|
||||
public enum PixelFormat {
|
||||
kUnknown(0), kMJPEG(1), kYUYV(2), kRGB565(3), kBGR(4);
|
||||
kUnknown(0), kMJPEG(1), kYUYV(2), kRGB565(3), kBGR(4), kGray(5);
|
||||
private int value;
|
||||
|
||||
private PixelFormat(int value) {
|
||||
|
||||
Reference in New Issue
Block a user