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