I downloaded the most recent WPILib library (2017.3.1), and the vision test sample no longer works. I rolled back the version, and it works. I have not been able to get any code using Sink/Source combination to work with the new Libraries, but they all work fine with the old. I am stumped, and if anyone notices something in the screen captures that would be appreciated:
Test Code (as deployed, based on sample posted)
http://wpilib.screenstepslive.com/s/4485/m/24194/l/669166-using-the-camera-server-on-the-roborio-2017
Works fine (displays gray scale image) under 2017.1.1, but not 2017.3.1 Screen captures attached.
package org.usfirst.frc.team1876.robot;
import edu.wpi.first.wpilibj.CameraServer;
import edu.wpi.first.wpilibj.IterativeRobot;
import org.opencv.core.Mat;
import org.opencv.imgproc.Imgproc;
import edu.wpi.cscore.CvSink;
import edu.wpi.cscore.CvSource;
import edu.wpi.cscore.UsbCamera;
import edu.wpi.first.wpilibj.CameraServer;
import edu.wpi.first.wpilibj.IterativeRobot;
/**
* Uses the CameraServer class to automatically capture video from a USB webcam
* and send it to the FRC dashboard without doing any vision processing. This
* is the easiest way to get camera images to the dashboard. Just add this to the
* robotInit() method in your program.
*/
public class Robot extends IterativeRobot {
@Override
public void robotInit() {
new Thread(() -> {
UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();
camera.setResolution(640, 480);
CvSink cvSink = CameraServer.getInstance().getVideo();
CvSource outputStream = CameraServer.getInstance().putVideo("Blur", 640, 480);
Mat source = new Mat();
Mat output = new Mat();
while(!Thread.interrupted()) {
cvSink.grabFrame(source);
Imgproc.cvtColor(source, output, Imgproc.COLOR_BGR2GRAY);
outputStream.putFrame(output);
}
}).start();
}
}