Add video mode change support to VisionProcess

This commit is contained in:
Matt
2019-11-16 11:10:55 -08:00
parent f426552644
commit 58c1924c7e
4 changed files with 34 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ package com.chameleonvision.classabstraction.camera;
import com.chameleonvision.vision.camera.StreamDivisor;
import com.chameleonvision.web.ServerHandler;
import edu.wpi.cscore.CvSource;
import edu.wpi.cscore.VideoMode;
import edu.wpi.first.cameraserver.CameraServer;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
@@ -39,6 +40,12 @@ public class CameraStreamer {
ServerHandler.sendFullSettings();
}
public void setNewVideoMode(VideoMode newVideoMode) {
// Trick to update cvSource and streamBuffer to the new resolution
// Must change the cameraProcess resolution first
setDivisor(divisor);
}
public void runStream(Mat image) {
image.copyTo(streamBuffer);
if (divisor.value != 1) {