mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Added method to set camera gain for PS3Eye
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user