More UI fixes, add videomode and StreamDivisor to config

This commit is contained in:
Banks Troutman
2019-11-29 14:24:34 -05:00
parent 3ff1f56bd5
commit 5b2af86f87
10 changed files with 51 additions and 31 deletions

View File

@@ -6,7 +6,7 @@ import edu.wpi.cscore.VideoMode;
public interface CameraCapture extends ImageCapture {
USBCameraProperties getProperties();
public VideoMode getCurrentVideoMode();
VideoMode getCurrentVideoMode();
/**
* Set the exposure of the camera
@@ -22,10 +22,16 @@ public interface CameraCapture extends ImageCapture {
/**
* Set the video mode (fps and resolution) of the camera
* @param mode the wanted mode
* @param mode the desired mode
*/
void setVideoMode(VideoMode mode);
/**
* Set the video mode (fps and resolution) of the camera
* @param index the index of the desired mode
*/
void setVideoMode(int index);
/**
* Set the gain of the camera
* NOTE - Not all cameras support this.

View File

@@ -68,14 +68,11 @@ public class USBCameraCapture implements CameraCapture {
System.err.println("Failed to change camera video mode!");
}
}
public void setVideoMode(int index){
VideoMode mode = properties.getVideoModes().get(index);
setVideoMode(mode);
}
public int getVideoModeIndex(){
return properties.getVideoModes().indexOf(properties.getStaticProperties().mode);
}
@Override
public void setGain(int gain) {

View File

@@ -68,8 +68,10 @@ public class USBCameraProperties extends CaptureProperties {
}
public void setFOV(double FOV) {
this.FOV = FOV;
staticProperties = new CaptureStaticProperties(staticProperties.mode, staticProperties.imageWidth, staticProperties.imageHeight, FOV);
if (this.FOV != FOV) {
this.FOV = FOV;
staticProperties = new CaptureStaticProperties(staticProperties.mode, staticProperties.imageWidth, staticProperties.imageHeight, FOV);
}
}
public double getFOV() {
@@ -97,4 +99,11 @@ public class USBCameraProperties extends CaptureProperties {
public List<VideoMode> getVideoModes() {
return videoModes;
}
public VideoMode getCurrentVideoMode() { return staticProperties.mode; }
public int getCurrentVideoModeIndex(){
return getVideoModes().indexOf(getCurrentVideoMode());
}
}