mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Create VideoCamera base class and move camera settings functions to it.
This makes them available for both UsbCamera and HttpCamera / AxisCamera. To avoid virtual functions in the public-facing interface, move the implementation of the camera settings functions to the core library.
This commit is contained in:
63
java/src/edu/wpi/cscore/VideoCamera.java
Normal file
63
java/src/edu/wpi/cscore/VideoCamera.java
Normal file
@@ -0,0 +1,63 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package edu.wpi.cscore;
|
||||
|
||||
/// A source that represents a video camera.
|
||||
public class VideoCamera extends VideoSource {
|
||||
public class WhiteBalance {
|
||||
public static final int kFixedIndoor = 3000;
|
||||
public static final int kFixedOutdoor1 = 4000;
|
||||
public static final int kFixedOutdoor2 = 5000;
|
||||
public static final int kFixedFluorescent1 = 5100;
|
||||
public static final int kFixedFlourescent2 = 5200;
|
||||
}
|
||||
|
||||
protected VideoCamera(int handle) {
|
||||
super(handle);
|
||||
}
|
||||
|
||||
/// Set the brightness, as a percentage (0-100).
|
||||
public synchronized void setBrightness(int brightness) {
|
||||
CameraServerJNI.setCameraBrightness(m_handle, brightness);
|
||||
}
|
||||
|
||||
/// Get the brightness, as a percentage (0-100).
|
||||
public synchronized int getBrightness() {
|
||||
return CameraServerJNI.getCameraBrightness(m_handle);
|
||||
}
|
||||
|
||||
/// Set the white balance to auto.
|
||||
public synchronized void setWhiteBalanceAuto() {
|
||||
CameraServerJNI.setCameraWhiteBalanceAuto(m_handle);
|
||||
}
|
||||
|
||||
/// Set the white balance to hold current.
|
||||
public synchronized void setWhiteBalanceHoldCurrent() {
|
||||
CameraServerJNI.setCameraWhiteBalanceHoldCurrent(m_handle);
|
||||
}
|
||||
|
||||
/// Set the white balance to manual, with specified color temperature.
|
||||
public synchronized void setWhiteBalanceManual(int value) {
|
||||
CameraServerJNI.setCameraWhiteBalanceManual(m_handle, value);
|
||||
}
|
||||
|
||||
/// Set the exposure to auto aperture.
|
||||
public synchronized void setExposureAuto() {
|
||||
CameraServerJNI.setCameraExposureAuto(m_handle);
|
||||
}
|
||||
|
||||
/// Set the exposure to hold current.
|
||||
public synchronized void setExposureHoldCurrent() {
|
||||
CameraServerJNI.setCameraExposureHoldCurrent(m_handle);
|
||||
}
|
||||
|
||||
/// Set the exposure to manual, as a percentage (0-100).
|
||||
public synchronized void setExposureManual(int value) {
|
||||
CameraServerJNI.setCameraExposureManual(m_handle, value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user