diff --git a/Main/src/main/java/com/chameleonvision/vision/camera/CameraCapture.java b/Main/src/main/java/com/chameleonvision/vision/camera/CameraCapture.java index 2233eb2cc..152bccaa0 100644 --- a/Main/src/main/java/com/chameleonvision/vision/camera/CameraCapture.java +++ b/Main/src/main/java/com/chameleonvision/vision/camera/CameraCapture.java @@ -13,7 +13,7 @@ public interface CameraCapture extends ImageCapture { void setExposure(int exposure); /** - * Set the exposure of the camera + * Set the brightness of the camera * @param brightness the new brightness to set the camera to */ void setBrightness(int brightness); @@ -23,4 +23,11 @@ public interface CameraCapture extends ImageCapture { * @param mode the wanted mode */ void setVideoMode(VideoMode mode); + + /** + * Set the gain of the camera + * NOTE - Not all cameras support this. + * @param gain the new gain to set the camera to + */ + void setGain(int gain); } diff --git a/Main/src/main/java/com/chameleonvision/vision/camera/USBCameraCapture.java b/Main/src/main/java/com/chameleonvision/vision/camera/USBCameraCapture.java index b3391bee8..d1f8371fb 100644 --- a/Main/src/main/java/com/chameleonvision/vision/camera/USBCameraCapture.java +++ b/Main/src/main/java/com/chameleonvision/vision/camera/USBCameraCapture.java @@ -42,7 +42,7 @@ public class USBCameraCapture implements CameraCapture { try { baseCamera.setExposureManual(exposure); } catch (VideoException e) { - System.err.println("Current camera does not support exposure change"); + System.err.println("Failed to change camera exposure!"); } } @@ -51,7 +51,7 @@ public class USBCameraCapture implements CameraCapture { try { baseCamera.setBrightness(brightness); } catch (VideoException e) { - System.err.println("Current camera does not support brightness change"); + System.err.println("Failed to change camera brightness!"); } } @@ -61,7 +61,19 @@ public class USBCameraCapture implements CameraCapture { baseCamera.setVideoMode(mode); properties.updateVideoMode(mode); } catch (VideoException e) { - System.err.println("Current camera does not support resolution change"); + System.err.println("Failed to change camera video mode!"); + } + } + + @Override + public void setGain(int gain) { + if (properties.isPS3Eye) { + try { + baseCamera.getProperty("gain_automatic").set(0); + baseCamera.getProperty("gain").set(gain); + } catch (Exception e) { + System.err.println("Failed to change camera gain!"); + } } } }