Rename USBCamera to USBCameraProcess & abstractify

- Most classes now take a CameraProcess instead of a USBCameraProcess
This commit is contained in:
Matt
2019-11-07 09:10:09 -08:00
parent 338c59e783
commit cc2c065dc8
9 changed files with 27 additions and 21 deletions

View File

@@ -99,13 +99,13 @@ public class USBCamera {
}
}
var initTimeMs = (System.nanoTime() - initTimeout) / 1e6;
System.out.printf("USBCamera initialized in %.2fms\n", initTimeMs);
System.out.printf("USBCameraProcess initialized in %.2fms\n", initTimeMs);
}
var trueVideoModes = UsbCam.enumerateVideoModes();
availableVideoModes = Arrays.stream(trueVideoModes).filter(v ->
v.fps >= MINIMUM_FPS && v.width >= MINIMUM_WIDTH && v.height >= MINIMUM_HEIGHT && ALLOWED_PIXEL_FORMATS.contains(v.pixelFormat)).toArray(VideoMode[]::new);
if (availableVideoModes.length == 0) {
System.err.println("USBCamera not supported!");
System.err.println("USBCameraProcess not supported!");
throw new RuntimeException(new CameraException(CameraException.CameraExceptionType.BAD_CAMERA));
}
if (videoModeIndex <= availableVideoModes.length - 1) {
@@ -283,7 +283,7 @@ public class USBCamera {
try {
UsbCam.setExposureManual(exposure);
} catch (VideoException e) {
System.err.println("USBCamera Does not support exposure change");
System.err.println("USBCameraProcess Does not support exposure change");
}
}

View File

@@ -122,7 +122,7 @@ public class StandardCVProcess implements CVProcess {
pipelineResult.IsValid = true;
switch (currentPipeline.calibrationMode) {
case None:
///use the center of the USBCamera to find the pitch and yaw difference
///use the center of the USBCameraProcess to find the pitch and yaw difference
pipelineResult.CalibratedX = cameraValues.CenterX;
pipelineResult.CalibratedY = cameraValues.CenterY;
break;

View File

@@ -80,7 +80,7 @@ public class USBCameraProcess implements CameraProcess {
}
}
// USBCamera stuff
// USBCameraProcess stuff
@Override
public String getCamName() {

View File

@@ -41,7 +41,7 @@ public class VisionProcess implements Runnable {
public VisionProcess(CameraProcess cameraProcess) {
// USBCamera settings
// USBCameraProcess settings
cvProcess = new StandardCVProcess(cameraProcess.getCamVals());
this.cameraProcess = cameraProcess; // new USBCameraProcess(cameraProcess);