Now running after merge to dev

This commit is contained in:
Banks Troutman
2019-11-27 18:09:27 -05:00
parent 9b694c4999
commit c5f2a90f86
7 changed files with 95 additions and 83 deletions

View File

@@ -27,18 +27,20 @@ public class CameraStreamer {
}
public void setDivisor(StreamDivisor newDivisor, boolean updateUI) {
this.divisor = newDivisor;
var camValues = cameraCapture.getProperties();
var newWidth = camValues.getStaticProperties().imageWidth / newDivisor.value;
var newHeight = camValues.getStaticProperties().imageHeight / newDivisor.value;
synchronized (streamBufferLock) {
this.streamBuffer = new Mat(newWidth, newHeight, CvType.CV_8UC3);
this.cvSource = CameraServer.getInstance().putVideo(this.name,
cameraCapture.getProperties().getStaticProperties().imageWidth / divisor.value,
cameraCapture.getProperties().getStaticProperties().imageHeight / divisor.value);
}
if (updateUI) {
SocketHandler.sendFullSettings();
if (divisor != newDivisor) {
this.divisor = newDivisor;
var camValues = cameraCapture.getProperties();
var newWidth = camValues.getStaticProperties().imageWidth / newDivisor.value;
var newHeight = camValues.getStaticProperties().imageHeight / newDivisor.value;
synchronized (streamBufferLock) {
this.streamBuffer = new Mat(newWidth, newHeight, CvType.CV_8UC3);
this.cvSource = CameraServer.getInstance().putVideo(this.name,
cameraCapture.getProperties().getStaticProperties().imageWidth / divisor.value,
cameraCapture.getProperties().getStaticProperties().imageHeight / divisor.value);
}
if (updateUI) {
SocketHandler.sendFullSettings();
}
}
}

View File

@@ -38,7 +38,7 @@ public class USBCameraProperties extends CaptureProperties {
public final boolean isPS3Eye;
private String nickname;
public double FOV;
private double FOV;
USBCameraProperties(UsbCamera baseCamera, CameraJsonConfig config) {
FOV = config.fov;
@@ -67,6 +67,15 @@ public class USBCameraProperties extends CaptureProperties {
videoModes = filterVideoModes(baseCamera.enumerateVideoModes());
}
public void setFOV(double FOV) {
this.FOV = FOV;
staticProperties = new CaptureStaticProperties(staticProperties.imageWidth, staticProperties.imageHeight, FOV);
}
public double getFOV() {
return FOV;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}