mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-21 01:01:41 +00:00
fixed resolution list send to ui
This commit is contained in:
@@ -4,15 +4,22 @@ import edu.wpi.cscore.VideoMode;
|
||||
import org.opencv.core.Scalar;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Helpers {
|
||||
private Helpers() {}
|
||||
private Helpers() {
|
||||
}
|
||||
|
||||
public static Scalar colorToScalar(Color color) {
|
||||
return new Scalar(color.getRed(), color.getGreen(), color.getBlue());
|
||||
}
|
||||
|
||||
public static String VideoModeToString(VideoMode videoMode) {
|
||||
return String.format("%dx%d@%dFPS in %s", videoMode.width, videoMode.height, videoMode.fps, videoMode.pixelFormat.toString());
|
||||
public static HashMap VideoModeToHashMap(VideoMode videoMode) {
|
||||
return new HashMap<String, Object>() {{
|
||||
put("width", videoMode.width);
|
||||
put("height", videoMode.height);
|
||||
put("fps", videoMode.fps);
|
||||
put("pixelFormat", videoMode.pixelFormat.toString());}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,11 +171,11 @@ public class VisionManager {
|
||||
ConfigManager.saveCameraDriverMode(getCurrentCameraName(), driverModeSettings);
|
||||
}
|
||||
|
||||
public static List<String> getCameraResolutionList(CameraCapture capture) {
|
||||
return capture.getProperties().getVideoModes().stream().map(Helpers::VideoModeToString).collect(Collectors.toList());
|
||||
public static List<HashMap> getCameraResolutionList(CameraCapture capture) {
|
||||
return capture.getProperties().getVideoModes().stream().map(object -> Helpers.VideoModeToHashMap(object)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<String> getCurrentCameraResolutionList() {
|
||||
public static List<HashMap> getCurrentCameraResolutionList() {
|
||||
return getCameraResolutionList(currentUIVisionProcess.getCamera());
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,6 @@ public class SocketHandler {
|
||||
tmp.put("fov", currentCamera.getProperties().getFOV());
|
||||
tmp.put("streamDivisor", currentVisionProcess.cameraStreamer.getDivisor().ordinal());
|
||||
// TODO: (HIGH) get videomode index!
|
||||
// tmp.put("resolution", currentCamera.getVideoModeIndex());
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -263,8 +262,6 @@ public class SocketHandler {
|
||||
CVPipeline currentPipeline = currentProcess.getCurrentPipeline();
|
||||
|
||||
try {
|
||||
// fullSettings.putAll(settingsToMap(ConfigManager.settings));
|
||||
// fullSettings.putAll(pipelineToMap(currentPipeline.settings));
|
||||
fullSettings.put("settings", getOrdinalSettings());
|
||||
fullSettings.put("cameraSettings", getOrdinalCameraSettings());
|
||||
fullSettings.put("cameraList", VisionManager.getAllCameraNicknames());
|
||||
|
||||
Reference in New Issue
Block a user