001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.cscore; 006 007/** A source that represents a video camera. */ 008public class VideoCamera extends VideoSource { 009 public static class WhiteBalance { 010 public static final int kFixedIndoor = 3000; 011 public static final int kFixedOutdoor1 = 4000; 012 public static final int kFixedOutdoor2 = 5000; 013 public static final int kFixedFluorescent1 = 5100; 014 public static final int kFixedFlourescent2 = 5200; 015 } 016 017 protected VideoCamera(int handle) { 018 super(handle); 019 } 020 021 /** 022 * Set the brightness, as a percentage (0-100). 023 * 024 * @param brightness Brightness as a percentage (0-100). 025 */ 026 public synchronized void setBrightness(int brightness) { 027 CameraServerJNI.setCameraBrightness(m_handle, brightness); 028 } 029 030 /** 031 * Get the brightness, as a percentage (0-100). 032 * 033 * @return The brightness as a percentage (0-100). 034 */ 035 public synchronized int getBrightness() { 036 return CameraServerJNI.getCameraBrightness(m_handle); 037 } 038 039 /** Set the white balance to auto. */ 040 public synchronized void setWhiteBalanceAuto() { 041 CameraServerJNI.setCameraWhiteBalanceAuto(m_handle); 042 } 043 044 /** Set the white balance to hold current. */ 045 public synchronized void setWhiteBalanceHoldCurrent() { 046 CameraServerJNI.setCameraWhiteBalanceHoldCurrent(m_handle); 047 } 048 049 /** 050 * Set the white balance to manual, with specified color temperature. 051 * 052 * @param value The specified color temperature. 053 */ 054 public synchronized void setWhiteBalanceManual(int value) { 055 CameraServerJNI.setCameraWhiteBalanceManual(m_handle, value); 056 } 057 058 /** Set the exposure to auto aperture. */ 059 public synchronized void setExposureAuto() { 060 CameraServerJNI.setCameraExposureAuto(m_handle); 061 } 062 063 /** Set the exposure to hold current. */ 064 public synchronized void setExposureHoldCurrent() { 065 CameraServerJNI.setCameraExposureHoldCurrent(m_handle); 066 } 067 068 /** 069 * Set the exposure to manual, as a percentage (0-100). 070 * 071 * @param value The exposure as a percentage (0-100). 072 */ 073 public synchronized void setExposureManual(int value) { 074 CameraServerJNI.setCameraExposureManual(m_handle, value); 075 } 076}