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