mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
Add video mode change support to VisionProcess
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user