mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Typo fix, begin work on VisionManager config loading, set CameraStaticProperties correctly
This commit is contained in:
@@ -7,6 +7,7 @@ import edu.wpi.cscore.UsbCameraInfo;
|
||||
import org.opencv.videoio.VideoCapture;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@@ -51,6 +52,12 @@ public class VisionManager {
|
||||
File cameraConfigFile = new File(cameraConfigPath.toString());
|
||||
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Files.createDirectory(cameraConfigFolder);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class VisionProcess {
|
||||
|
||||
// Thread to put frames on the dashboard
|
||||
this.cameraStreamer = new CameraStreamer(cameraProcess, name);
|
||||
this.streamRunnable = new CameraStramerRunnable(streamTimeMs, cameraStreamer);
|
||||
this.streamRunnable = new CameraStreamerRunnable(streamTimeMs, cameraStreamer);
|
||||
new Thread(streamRunnable).start();
|
||||
|
||||
// Thread to process vision data
|
||||
|
||||
@@ -30,8 +30,6 @@ public class CameraProperties {
|
||||
|
||||
public CameraProperties(UsbCamera baseCamera, double fov) {
|
||||
FOV = fov;
|
||||
|
||||
// TODO: determine how to set the initial videomode properly
|
||||
videoModes = filterVideoModes(baseCamera.enumerateVideoModes());
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,9 @@ public class USBCameraProcess implements CameraProcess {
|
||||
public USBCameraProcess(UsbCamera camera, CameraConfig config) {
|
||||
baseCamera = camera;
|
||||
cvSink = CameraServer.getInstance().getVideo(baseCamera);
|
||||
VideoMode vidMode = new VideoMode(VideoMode.PixelFormat.kYUYV, 640, 480, 60);
|
||||
properties = new CameraProperties(baseCamera, config.FOV);
|
||||
|
||||
setVideoMode(properties.videoModes.get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,7 +59,7 @@ public class USBCameraProcess implements CameraProcess {
|
||||
public void setVideoMode(VideoMode mode) {
|
||||
try {
|
||||
baseCamera.setVideoMode(mode);
|
||||
properties = new CameraProperties(baseCamera, properties.FOV);
|
||||
properties.updateVideoMode(mode);
|
||||
} catch (VideoException e) {
|
||||
System.err.println("Current camera does not support resolution change");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user