Fawkes API  Fawkes Development Version
image.cpp
1 
2 /***************************************************************************
3  * image.cpp - Abstract class defining a camera image controller
4  *
5  * Created: Wed Apr 22 11:32:56 CEST 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/image.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 CameraControlImage <fvcams/control/image.h>
35  * Camera image control interface.
36  * Some cameras feature adjustable image controls
37  * like size, format or mirroring.
38  *
39  * This interface shall be implemented by such cameras.
40  *
41  * @author Tobias Kellner
42  * @author Tim Niemueller
43  *
44  * @fn unsigned int CameraControlImage::width() = 0
45  * Get the current width of the image.
46  * @return width in pixels
47  *
48  * @fn unsigned int CameraControlImage::height() = 0
49  * Get the current height of the image.
50  * @return height in pixels
51  *
52  * @fn void CameraControlImage::set_size(unsigned int width, unsigned int height) = 0
53  * Set the image size the camera should use.
54  * @param width new width of the image
55  * @param height new height of the image
56  * @exception Exception thrown for instance if size setting at run-time is not supported
57  */
58 
60 
61 /** Empty virtual destructor. */
63 {
64 }
65 
66 
67 /** Get the image format the camera currently uses.
68  * Check implementation documentation for details on the format.
69  * @return a string describing the image format
70  * @throws NotImplementedException Not implemented by this control
71  */
72 const char *
74 {
75  throw NotImplementedException("Not implemented");
76 }
77 
78 
79 /** Set the image format the camera should use.
80  * Check implementation documentation for details on the format.
81  * @param format the new image format
82  * @throws NotImplementedException Not implemented by this control
83  */
84 void
86 {
87  throw NotImplementedException("Not implemented");
88 }
89 
90 
91 /** Get the current image size.
92  * @param[out] width upon return contains the width of the image
93  * @param[out] height upon return contains the height of the image
94  */
95 void
96 CameraControlImage::size(unsigned int &width, unsigned int &height)
97 {
98  width = this->width();
99  height = this->height();
100 }
101 
102 /** Return whether the camera image is horizontally mirrored.
103  * @return true if the image is horizontally mirrored
104  * @throws NotImplementedException Not implemented by this control
105  */
106 bool
108 {
109  throw NotImplementedException("Not implemented");
110 }
111 
112 
113 /** Return whether the camera image is vertically mirrored.
114  * @return true if the image is vertically mirrored
115  * @throws NotImplementedException Not implemented by this control
116  */
117 bool
119 {
120  throw NotImplementedException("Not implemented");
121 }
122 
123 
124 /** Get information about current camera image mirroring.
125  * @param[out] horiz upon return contains flag if horizontal mirroring is enabled
126  * @param[out] vert upon return contains flag if vertical mirroring is enabled
127  * @throws NotImplementedException Not implemented by this control
128  */
129 void
130 CameraControlImage::mirror(bool &horiz, bool &vert)
131 {
132  horiz = horiz_mirror();
133  vert = vert_mirror();
134 }
135 
136 
137 /** Set whether the camera should mirror images horizontally.
138  * @param enabled if true, images should be mirrored horizontally
139  * @throws NotImplementedException Not implemented by this control
140  */
141 void
143 {
144  throw NotImplementedException("Not implemented");
145 }
146 
147 
148 /** Set whether the camera should mirror images vertically.
149  * @param enabled if true, images should be mirrored vertically
150  * @throws NotImplementedException Not implemented by this control
151  */
152 void
154 {
155  throw NotImplementedException("Not implemented");
156 }
157 
158 
159 /** Set whether the camera should mirror images.
160  * @param horiz true to mirror images horizontally, false to disable mirroring
161  * @param vert true to mirror images vertically, false to disable mirroring
162  * @throws NotImplementedException Not implemented by this control
163  */
164 void
165 CameraControlImage::set_mirror(bool horiz, bool vert)
166 {
167  set_horiz_mirror(horiz);
168  set_vert_mirror(vert);
169 }
170 
171 
172 /** Get the number of frames per second the camera tries to deliver.
173  * @return the current fps
174  * @throws NotImplementedException Not implemented by this control
175  */
176 unsigned int
178 {
179  throw NotImplementedException("Not implemented");
180 }
181 
182 
183 /** Set the number of frames per second the camera tries to deliver.
184  * @param fps the new fps
185  * @throws NotImplementedException Not implemented by this control
186  */
187 void
189 {
190  throw NotImplementedException("Not implemented");
191 }
192 
193 
194 /** Get current lens x correction
195  * @return current lens x correction
196  * @throws NotImplementedException Not implemented by this control
197  */
198 unsigned int
200 {
201  throw NotImplementedException("Not implemented");
202 }
203 
204 
205 /** Get current lens y correction
206  * @return current lens y correction
207  * @throws NotImplementedException Not implemented by this control
208  */
209 unsigned int
211 {
212  throw NotImplementedException("Not implemented");
213 }
214 
215 
216 /** Get current lens correction
217  * @param[out] x_corr where the current lens x correction will be stored
218  * @param[out] y_corr where the current lens y correction will be stored
219  * @throws NotImplementedException Not implemented by this control
220  */
221 void
222 CameraControlImage::lens_corr(unsigned int &x_corr, unsigned int &y_corr)
223 {
224  x_corr = this->lens_x_corr();
225  y_corr = this->lens_y_corr();
226 }
227 
228 
229 /** Set lens x correction
230  * @param x_corr new lens x correction
231  * @throws NotImplementedException Not implemented by this control
232  */
233 void
235 {
236  throw NotImplementedException("Not implemented");
237 }
238 
239 
240 /** Set lens y correction
241  * @param y_corr new lens y correction
242  * @throws NotImplementedException Not implemented by this control
243  */
244 void
246 {
247  throw NotImplementedException("Not implemented");
248 }
249 
250 
251 /** Set lens correction
252  * @param x_corr new lens x correction
253  * @param y_corr new lens y correction
254  * @throws NotImplementedException Not implemented by this control
255  */
256 void
257 CameraControlImage::set_lens_corr(unsigned int x_corr, unsigned int y_corr)
258 {
259  set_lens_x_corr(x_corr);
260  set_lens_y_corr(y_corr);
261 }
262 
263 } // end namespace firevision
virtual bool vert_mirror()
Return whether the camera image is vertically mirrored.
Definition: image.cpp:118
virtual void set_lens_y_corr(unsigned int y_corr)
Set lens y correction.
Definition: image.cpp:245
virtual unsigned int lens_y_corr()
Get current lens y correction.
Definition: image.cpp:210
virtual void set_format(const char *format)
Set the image format the camera should use.
Definition: image.cpp:85
virtual ~CameraControlImage()
Empty virtual destructor.
Definition: image.cpp:62
Called method has not been implemented.
Definition: software.h:107
virtual void lens_corr(unsigned int &x_corr, unsigned int &y_corr)
Get current lens correction.
Definition: image.cpp:222
virtual void set_vert_mirror(bool enabled)
Set whether the camera should mirror images vertically.
Definition: image.cpp:153
virtual void set_lens_x_corr(unsigned int x_corr)
Set lens x correction.
Definition: image.cpp:234
virtual void mirror(bool &horiz, bool &vert)
Get information about current camera image mirroring.
Definition: image.cpp:130
virtual void set_mirror(bool horiz, bool vert)
Set whether the camera should mirror images.
Definition: image.cpp:165
virtual const char * format()
Get the image format the camera currently uses.
Definition: image.cpp:73
virtual void size(unsigned int &width, unsigned int &height)
Get the current image size.
Definition: image.cpp:96
virtual bool horiz_mirror()
Return whether the camera image is horizontally mirrored.
Definition: image.cpp:107
virtual unsigned int height()=0
Get the current height of the image.
virtual unsigned int fps()
Get the number of frames per second the camera tries to deliver.
Definition: image.cpp:177
virtual void set_fps(unsigned int fps)
Set the number of frames per second the camera tries to deliver.
Definition: image.cpp:188
virtual void set_lens_corr(unsigned int x_corr, unsigned int y_corr)
Set lens correction.
Definition: image.cpp:257
virtual unsigned int width()=0
Get the current width of the image.
virtual unsigned int lens_x_corr()
Get current lens x correction.
Definition: image.cpp:199
virtual void set_horiz_mirror(bool enabled)
Set whether the camera should mirror images horizontally.
Definition: image.cpp:142