diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java b/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java index 19392c30c2..5dbc6b5a08 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java @@ -44,11 +44,7 @@ public class QuirkyCamera { new QuirkyCamera(-1, -1, "LifeCam Cinema (TM)", CameraQuirk.LifeCamControls), // PS3Eye new QuirkyCamera( - 0x1415, - 0x2000, - CameraQuirk.Gain, - CameraQuirk.FPSCap100, - CameraQuirk.PsEyeControls), + 0x1415, 0x2000, CameraQuirk.Gain, CameraQuirk.FPSCap100, CameraQuirk.PsEyeControls), // Logitech C925-e new QuirkyCamera(0x85B, 0x46D, CameraQuirk.AdjustableFocus), // Generic arducam. Since OV2311 can't be differentiated diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/ArduOV2311CameraSettables.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/ArduOV2311CameraSettables.java index c05861342a..f69e1da89b 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/ArduOV2311CameraSettables.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/ArduOV2311CameraSettables.java @@ -1,12 +1,26 @@ +/* + * Copyright (C) Photon Vision. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package org.photonvision.vision.camera.USBCameras; import edu.wpi.first.cscore.UsbCamera; - - import org.photonvision.common.configuration.CameraConfiguration; public class ArduOV2311CameraSettables extends GenericUSBCameraSettables { - public ArduOV2311CameraSettables(CameraConfiguration configuration, UsbCamera camera) { super(configuration, camera); } @@ -19,5 +33,4 @@ protected void setUpExposureProperties() { this.minExposure = 1; this.maxExposure = 75; } - } diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java index 4235c03963..9e145530c5 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) Photon Vision. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package org.photonvision.vision.camera.USBCameras; import edu.wpi.first.cscore.UsbCamera; @@ -52,7 +69,6 @@ public GenericUSBCameraSettables(CameraConfiguration configuration, UsbCamera ca setVideoMode(videoModes.get(0)); // fixes double FPS set } } - } protected void setUpExposureProperties() { @@ -144,7 +160,6 @@ public void setExposureRaw(double exposureRaw) { this.lastExposureRaw = exposureRaw; - } catch (VideoException e) { logger.error("Failed to set camera exposure!", e); } @@ -285,6 +300,4 @@ protected Optional findProperty(String... options) { return Optional.ofNullable(retProp); } - - } diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/LifeCam3kCameraSettables.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/LifeCam3kCameraSettables.java index c5a7752195..18b04f7e9f 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/LifeCam3kCameraSettables.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/LifeCam3kCameraSettables.java @@ -1,17 +1,29 @@ +/* + * Copyright (C) Photon Vision. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package org.photonvision.vision.camera.USBCameras; import edu.wpi.first.cscore.UsbCamera; import edu.wpi.first.cscore.VideoException; - - import org.photonvision.common.configuration.CameraConfiguration; import org.photonvision.common.util.math.MathUtils; public class LifeCam3kCameraSettables extends GenericUSBCameraSettables { - - private static int[] allowableExposures = { - 5, 10, 20, 39, 78, 156, 312, 625 - }; + private static int[] allowableExposures = {5, 10, 20, 39, 78, 156, 312, 625}; public LifeCam3kCameraSettables(CameraConfiguration configuration, UsbCamera camera) { super(configuration, camera); @@ -19,7 +31,6 @@ public LifeCam3kCameraSettables(CameraConfiguration configuration, UsbCamera cam @Override protected void setUpExposureProperties() { - autoExposureProp = findProperty("exposure_auto", "auto_exposure").get(); exposureAbsProp = findProperty("raw_exposure_time_absolute", "raw_exposure_absolute").get(); @@ -31,7 +42,6 @@ protected void setUpExposureProperties() { public void setExposureRaw(double exposureRaw) { if (exposureRaw >= 0.0) { try { - int propVal = (int) MathUtils.limit(exposureRaw, minExposure, maxExposure); propVal = MathUtils.quantize(propVal, allowableExposures); diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/LifeCam3kWindowsCameraSettables.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/LifeCam3kWindowsCameraSettables.java index 119a31aa4a..d7e55eb2ec 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/LifeCam3kWindowsCameraSettables.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/LifeCam3kWindowsCameraSettables.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) Photon Vision. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package org.photonvision.vision.camera.USBCameras; import edu.wpi.first.cscore.UsbCamera; @@ -6,16 +23,14 @@ import org.photonvision.common.util.math.MathUtils; public class LifeCam3kWindowsCameraSettables extends GenericUSBCameraSettables { - public LifeCam3kWindowsCameraSettables(CameraConfiguration configuration, UsbCamera camera) { super(configuration, camera); } @Override protected void setUpExposureProperties() { - autoExposureProp = null; // Not Used - exposureAbsProp = null; //Not Used + exposureAbsProp = null; // Not Used // We'll fallback on cscore's implementation for windows lifecam this.minExposure = 0; @@ -26,10 +41,9 @@ protected void setUpExposureProperties() { public void setExposureRaw(double exposureRaw) { if (exposureRaw >= 0.0) { try { - int propVal = (int) MathUtils.limit(exposureRaw, minExposure, maxExposure); - //exposureAbsProp.set(propVal); + // exposureAbsProp.set(propVal); camera.setExposureManual(propVal); this.lastExposureRaw = exposureRaw; @@ -54,7 +68,7 @@ public void setAutoExposure(boolean cameraAutoExposure) { // Most cameras leave exposure time absolute at the last value from their AE // algorithm. // Set it back to the exposure slider value - camera.setExposureManual( (int) this.lastExposureRaw); + camera.setExposureManual((int) this.lastExposureRaw); } else { camera.setExposureAuto(); } diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/PsEyeCameraSettables.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/PsEyeCameraSettables.java index ceacf125ff..8195ca4931 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/PsEyeCameraSettables.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/PsEyeCameraSettables.java @@ -1,12 +1,26 @@ +/* + * Copyright (C) Photon Vision. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package org.photonvision.vision.camera.USBCameras; import edu.wpi.first.cscore.UsbCamera; - - import org.photonvision.common.configuration.CameraConfiguration; public class PsEyeCameraSettables extends GenericUSBCameraSettables { - public PsEyeCameraSettables(CameraConfiguration configuration, UsbCamera camera) { super(configuration, camera); } @@ -18,7 +32,7 @@ public void setAutoExposure(boolean cameraAutoExposure) { if (!cameraAutoExposure) { autoExposureProp.set(1); - // Most cameras leave exposure time absolute at the last value + // Most cameras leave exposure time absolute at the last value // from their auto exposure algorithm. // Set it back to the exposure slider value setExposureRaw(this.lastExposureRaw); @@ -31,14 +45,12 @@ public void setAutoExposure(boolean cameraAutoExposure) { public void setAllCamDefaults() { // Common settings for all cameras to attempt to get their image // as close as possible to what we want for image processing - softSet("raw_hue", 0); - softSet("raw_contrast", 32); - softSet("raw_saturation", 100); - softSet("raw_hue", -10); - softSet("raw_sharpness", 0); - softSet("white_balance_automatic", 0); - softSet("gain_automatic", 0); + softSet("raw_hue", 0); + softSet("raw_contrast", 32); + softSet("raw_saturation", 100); + softSet("raw_hue", -10); + softSet("raw_sharpness", 0); + softSet("white_balance_automatic", 0); + softSet("gain_automatic", 0); } - - } diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/USBCameraSource.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/USBCameraSource.java index 0d6b02e2ab..0affef41e4 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/USBCameraSource.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/USBCameraSource.java @@ -108,23 +108,22 @@ public USBCameraSource(CameraConfiguration config) { * @return */ private GenericUSBCameraSettables createSettables(CameraConfiguration config, UsbCamera camera) { - var quirks = getCameraConfiguration().cameraQuirks; GenericUSBCameraSettables settables; if (quirks.hasQuirk(CameraQuirk.LifeCamControls)) { - if(RuntimeDetector.isWindows()){ + if (RuntimeDetector.isWindows()) { logger.debug("Using Microsoft Lifecam 3000 Windows-Specific Settables"); settables = new LifeCam3kWindowsCameraSettables(config, camera); } else { logger.debug("Using Microsoft Lifecam 3000 Settables"); settables = new LifeCam3kCameraSettables(config, camera); } - }else if (quirks.hasQuirk(CameraQuirk.PsEyeControls)){ + } else if (quirks.hasQuirk(CameraQuirk.PsEyeControls)) { logger.debug("Using PlayStation Eye Camera Settables"); settables = new PsEyeCameraSettables(config, camera); - }else if (quirks.hasQuirk(CameraQuirk.ArduOV2311Controls)){ + } else if (quirks.hasQuirk(CameraQuirk.ArduOV2311Controls)) { logger.debug("Using Arducam OV2311 Settables"); settables = new ArduOV2311CameraSettables(config, camera); } else {