Our team generates an OpenCV image and sends it to the ShuffleBoard this way:
outputStream = CameraServer.getInstance().putVideo("OperatorImage", 640, 45);
Map<String, Object> cameraWidgetProperties = new HashMap<String, Object>();
cameraWidgetProperties.put("Show crosshair", false);
cameraWidgetProperties.put("Show controls", false);
Main.cameraTab.add("High Power Port Alignment", mjpegServer
.withWidget(BuiltInWidgets.kCameraStream)
.withProperties(cameraWidgetProperties)
.withSize(12, 1)
.withPosition(20, 0);
Shuffleboard.update();
outputStream.putFrame(mat);
The image shows perfectly on the ShuffleBoard but the simplest, small image consumes a huge amount of bandwidth.
We can’t find a way to compress CameraServer objects. (Showing the controls on the ShuffleBoard does allow changing the compression/quality but that is not automatic.)
Using the MjpegServer opens up many settable parameters including quality but the image won’t show in ShuffleBoard.
Using this instead of CameraServer:
CvSource outputStream = new CvSource("OperatorImage", VideoMode.PixelFormat.kMJPEG, 640, 45, 30);
MjpegServer mjpegServer = new MjpegServer("serve_OperatorImage", 1186);
mjpegServer.setCompression(50);
mjpegServer.setSource(outputStream);
does compress the image but it can’t be displayed in ShuffleBoard.
Is there a way to compress automatically (programatically not manually) an OpenCV image on the ShuffleBoard?