Fawkes API  Fawkes Development Version
color.cpp
1 
2 /***************************************************************************
3  * color.cpp - Abstract class defining a camera color controller
4  *
5  * Created: Wed Apr 22 11:19:04 2009
6  * Copyright 2009 Tobias Kellner
7  * 2005-2009 Tim Niemueller [www.niemueller.de]
8  *
9  ****************************************************************************/
10 
11 
12 /* This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version. A runtime exception applies to
16  * this software (see LICENSE.GPL_WRE file mentioned below for details).
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Library General Public License for more details.
22  *
23  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
24  */
25 
26 #include <fvcams/control/color.h>
27 #include <core/exceptions/software.h>
28 
29 namespace firevision {
30 #if 0 /* just to make Emacs auto-indent happy */
31 }
32 #endif
33 
34 /** @class CameraControlColor <fvcams/control/color.h>
35  * Camera color control interface.
36  * Some cameras feature adjustable color controls
37  * like white balance, brightness etc.
38  * In general methods might throw an NotImplementedException if a particular
39  * method if not available.
40  *
41  * This interface shall be implemented by such cameras.
42  *
43  * @author Tobias Kellner
44  * @author Tim Niemueller
45  *
46  *
47  * @fn bool CameraControlColor::auto_gain() = 0
48  * Return whether auto gain is enabled.
49  * @return true if auto gain is enabled
50  *
51  * @fn void CameraControlColor::set_auto_gain(bool enabled) = 0
52  * Enable/disable auto gain.
53  * @param enabled whether auto gain should be enabled
54  *
55  * @fn bool CameraControlColor::auto_white_balance() = 0
56  * Return whether auto white balance is enabled.
57  * @return true if auto white balance is enabled
58  *
59  * @fn void CameraControlColor::set_auto_white_balance(bool enabled) = 0
60  * Enable/disable auto white balance.
61  * @param enabled whether auto white balance should be enabled
62  *
63  * @fn bool CameraControlColor::exposure_auto() = 0
64  * Return whether auto exposure is enabled.
65  * @return true if auto exposure is enabled
66  *
67  * @fn void CameraControlColor::set_exposure_auto(bool enabled) = 0
68  * Enable/disable auto exposure.
69  * @param enabled whether auto exposure should be enabled
70  *
71  * @fn int CameraControlColor::red_balance() = 0
72  * Get current red balance.
73  * @return current red balance value
74  *
75  * @fn int CameraControlColor::set_red_balance(int red_balance) = 0
76  * Set red balance.
77  * @param red_balance new red balance
78  *
79  * @fn int CameraControlColor::blue_balance() = 0
80  * Get current blue balance.
81  * @return current blue balance value
82  *
83  * @fn void CameraControlColor::set_blue_balance(int blue_balance) = 0
84  * Set blue balance.
85  * @param blue_balance new blue balance
86  *
87  * @fn int CameraControlColor::u_balance() = 0
88  * Get current u balance.
89  * @return current u balance value
90  *
91  * @fn void CameraControlColor::set_u_balance(int u_balance) = 0
92  * Set u balance.
93  * @param u_balance new u balance
94  *
95  * @fn int CameraControlColor::v_balance() = 0
96  * Get current v balance.
97  * @return current v balance value
98  *
99  * @fn void CameraControlColor::set_v_balance(int v_balance) = 0
100  * Set v balance.
101  * @param v_balance new v balance
102  *
103  * @fn unsigned int CameraControlColor::brightness() = 0
104  * Get current brightness.
105  * @return current brightness value
106  *
107  * @fn void CameraControlColor::set_brightness(unsigned int brightness) = 0
108  * Set new brightness.
109  * @param brightness new brightness
110  *
111  * @fn unsigned int CameraControlColor::contrast() = 0
112  * Get current contrast.
113  * @return current contrast value
114  *
115  * @fn void CameraControlColor::set_contrast(unsigned int contrast) = 0
116  * Set new contrast.
117  * @param contrast new contrast
118  *
119  * @fn unsigned int CameraControlColor::saturation() = 0
120  * Get current saturation.
121  * @return current saturation value
122  *
123  * @fn void CameraControlColor::set_saturation(unsigned int saturation) = 0
124  * Set new saturation.
125  * @param saturation new saturation
126  *
127  * @fn int CameraControlColor::hue() = 0
128  * Get current hue.
129  * @return current hue value
130  *
131  * @fn void CameraControlColor::set_hue(int hue) = 0
132  * Set new hue.
133  * @param hue new hue
134  *
135  * @fn unsigned int CameraControlColor::exposure() = 0
136  * Get current exposure
137  * @return current exposure value
138  *
139  * @fn void CameraControlColor::set_exposure(unsigned int exposure) = 0
140  * Set new exposure.
141  * @param exposure new exposure
142  *
143  * @fn unsigned int CameraControlColor::gain() = 0
144  * Get current gain.
145  * @return current gain value
146  *
147  * @fn void CameraControlColor::set_gain(unsigned int gain) = 0
148  * Set new gain.
149  * @param gain new gain
150  */
151 
153 
154 /** Empty virtual destructor. */
156 {
157 }
158 
159 
160 /** Enable/disable all automatic settings.
161  * Most of the time, you'll want to disable all of them.
162  * @param enabled whether the automatic settings should be enabled or disabled
163  */
164 void
166 {
167  try {
168  set_auto_gain(enabled);
169  } catch (NotImplementedException) {}
170  try {
171  set_auto_white_balance(enabled);
172  } catch (NotImplementedException) {}
173  try {
174  set_exposure_auto(enabled);
175  } catch (NotImplementedException) {}
176 }
177 
178 } // end namespace firevision
virtual void set_auto_white_balance(bool enabled)=0
Enable/disable auto white balance.
Called method has not been implemented.
Definition: software.h:107
virtual void set_auto_all(bool enabled)
Enable/disable all automatic settings.
Definition: color.cpp:165
virtual ~CameraControlColor()
Empty virtual destructor.
Definition: color.cpp:155
virtual void set_auto_gain(bool enabled)=0
Enable/disable auto gain.
virtual void set_exposure_auto(unsigned int enabled)=0
Enable/disable auto exposure.