Fawkes API  Fawkes Development Version
color.cpp
00001 
00002 /***************************************************************************
00003  *  color.cpp - Abstract class defining a camera color controller
00004  *
00005  *  Created: Wed Apr 22 11:19:04 2009
00006  *  Copyright  2009      Tobias Kellner
00007  *             2005-2009 Tim Niemueller [www.niemueller.de]
00008  *
00009  ****************************************************************************/
00010 
00011 
00012 /*  This program is free software; you can redistribute it and/or modify
00013  *  it under the terms of the GNU General Public License as published by
00014  *  the Free Software Foundation; either version 2 of the License, or
00015  *  (at your option) any later version. A runtime exception applies to
00016  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00017  *
00018  *  This program is distributed in the hope that it will be useful,
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *  GNU Library General Public License for more details.
00022  *
00023  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00024  */
00025 
00026 #include <cams/control/color.h>
00027 #include <core/exceptions/software.h>
00028 
00029 namespace firevision {
00030 #if 0 /* just to make Emacs auto-indent happy */
00031 }
00032 #endif
00033 
00034 /** @class CameraControlColor <cams/control/color.h>
00035  * Camera color control interface.
00036  * Some cameras feature adjustable color controls
00037  * like white balance, brightness etc.
00038  * In general methods might throw an NotImplementedException if a particular
00039  * method if not available.
00040  *
00041  * This interface shall be implemented by such cameras.
00042  *
00043  * @author Tobias Kellner
00044  * @author Tim Niemueller
00045  *
00046  *
00047  * @fn bool CameraControlColor::auto_gain() = 0
00048  * Return whether auto gain is enabled.
00049  * @return true if auto gain is enabled
00050  *
00051  * @fn void CameraControlColor::set_auto_gain(bool enabled) = 0
00052  * Enable/disable auto gain.
00053  * @param enabled whether auto gain should be enabled
00054  *
00055  * @fn bool CameraControlColor::auto_white_balance() = 0
00056  * Return whether auto white balance is enabled.
00057  * @return true if auto white balance is enabled
00058  *
00059  * @fn void CameraControlColor::set_auto_white_balance(bool enabled) = 0
00060  * Enable/disable auto white balance.
00061  * @param enabled whether auto white balance should be enabled
00062  *
00063  * @fn bool CameraControlColor::auto_exposure() = 0
00064  * Return whether auto exposure is enabled.
00065  * @return true if auto exposure is enabled
00066  *
00067  * @fn void CameraControlColor::set_auto_exposure(bool enabled) = 0
00068  * Enable/disable auto exposure.
00069  * @param enabled whether auto exposure should be enabled
00070  *
00071  * @fn int CameraControlColor::red_balance() = 0
00072  * Get current red balance.
00073  * @return current red balance value
00074  *
00075  * @fn int CameraControlColor::set_red_balance(int red_balance) = 0
00076  * Set red balance.
00077  * @param red_balance new red balance
00078  *
00079  * @fn int CameraControlColor::blue_balance() = 0
00080  * Get current blue balance.
00081  * @return current blue balance value
00082  *
00083  * @fn void CameraControlColor::set_blue_balance(int blue_balance) = 0
00084  * Set blue balance.
00085  * @param blue_balance new blue balance
00086  *
00087  * @fn int CameraControlColor::u_balance() = 0
00088  * Get current u balance.
00089  * @return current u balance value
00090  *
00091  * @fn void CameraControlColor::set_u_balance(int u_balance) = 0
00092  * Set u balance.
00093  * @param u_balance new u balance
00094  *
00095  * @fn int CameraControlColor::v_balance() = 0
00096  * Get current v balance.
00097  * @return current v balance value
00098  *
00099  * @fn void CameraControlColor::set_v_balance(int v_balance) = 0
00100  * Set v balance.
00101  * @param v_balance new v balance
00102  *
00103  * @fn unsigned int CameraControlColor::brightness() = 0
00104  * Get current brightness.
00105  * @return current brightness value
00106  *
00107  * @fn void CameraControlColor::set_brightness(unsigned int brightness) = 0
00108  * Set new brightness.
00109  * @param brightness new brightness
00110  *
00111  * @fn unsigned int CameraControlColor::contrast() = 0
00112  * Get current contrast.
00113  * @return current contrast value
00114  *
00115  * @fn void CameraControlColor::set_contrast(unsigned int contrast) = 0
00116  * Set new contrast.
00117  * @param contrast new contrast
00118  *
00119  * @fn unsigned int CameraControlColor::saturation() = 0
00120  * Get current saturation.
00121  * @return current saturation value
00122  *
00123  * @fn void CameraControlColor::set_saturation(unsigned int saturation) = 0
00124  * Set new saturation.
00125  * @param saturation new saturation
00126  *
00127  * @fn int CameraControlColor::hue() = 0
00128  * Get current hue.
00129  * @return current hue value
00130  *
00131  * @fn void CameraControlColor::set_hue(int hue) = 0
00132  * Set new hue.
00133  * @param hue new hue
00134  *
00135  * @fn unsigned int CameraControlColor::exposure() = 0
00136  * Get current exposure
00137  * @return current exposure value
00138  *
00139  * @fn void CameraControlColor::set_exposure(unsigned int exposure) = 0
00140  * Set new exposure.
00141  * @param exposure new exposure
00142  *
00143  * @fn unsigned int CameraControlColor::gain() = 0
00144  * Get current gain.
00145  * @return current gain value
00146  *
00147  * @fn void CameraControlColor::set_gain(unsigned int gain) = 0
00148  * Set new gain.
00149  * @param gain new gain
00150  */
00151 
00152 using fawkes::NotImplementedException;
00153 
00154 /** Empty virtual destructor. */
00155 CameraControlColor::~CameraControlColor()
00156 {
00157 }
00158 
00159 
00160 /** Enable/disable all automatic settings.
00161  * Most of the time, you'll want to disable all of them.
00162  * @param enabled whether the automatic settings should be enabled or disabled
00163  */
00164 void
00165 CameraControlColor::set_auto_all(bool enabled)
00166 {
00167   try {
00168     set_auto_gain(enabled);
00169   } catch (NotImplementedException) {}
00170   try {
00171     set_auto_white_balance(enabled);
00172   } catch (NotImplementedException) {}
00173   try {
00174     set_auto_exposure(enabled);
00175   } catch (NotImplementedException) {}
00176 }
00177 
00178 } // end namespace firevision