image.cpp
00001 00002 /*************************************************************************** 00003 * image.cpp - Abstract class defining a camera image controller 00004 * 00005 * Created: Wed Apr 22 11:32:56 CEST 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/image.h> 00027 #include <core/exceptions/software.h> 00028 00029 /** @class CameraControlImage <cams/control/image.h> 00030 * Camera image control interface. 00031 * Some cameras feature adjustable image controls 00032 * like size, format or mirroring. 00033 * 00034 * This interface shall be implemented by such cameras. 00035 * 00036 * @author Tobias Kellner 00037 * @author Tim Niemueller 00038 * 00039 * @fn unsigned int CameraControlImage::width() = 0 00040 * Get the current width of the image. 00041 * @return width in pixels 00042 * 00043 * @fn unsigned int CameraControlImage::height() = 0 00044 * Get the current height of the image. 00045 * @return height in pixels 00046 * 00047 * @fn void CameraControlImage::set_size(unsigned int width, unsigned int height) = 0 00048 * Set the image size the camera should use. 00049 * @param width new width of the image 00050 * @param height new height of the image 00051 * @exception Exception thrown for instance if size setting at run-time is not supported 00052 */ 00053 00054 using fawkes::NotImplementedException; 00055 00056 /** Empty virtual destructor. */ 00057 CameraControlImage::~CameraControlImage() 00058 { 00059 } 00060 00061 00062 /** Get the image format the camera currently uses. 00063 * Check implementation documentation for details on the format. 00064 * @return a string describing the image format 00065 * @throws NotImplementedException Not implemented by this control 00066 */ 00067 const char * 00068 CameraControlImage::format() 00069 { 00070 throw NotImplementedException("Not implemented"); 00071 } 00072 00073 00074 /** Set the image format the camera should use. 00075 * Check implementation documentation for details on the format. 00076 * @param format the new image format 00077 * @throws NotImplementedException Not implemented by this control 00078 */ 00079 void 00080 CameraControlImage::set_format(const char *format) 00081 { 00082 throw NotImplementedException("Not implemented"); 00083 } 00084 00085 00086 /** Get the current image size. 00087 * @param[out] width upon return contains the width of the image 00088 * @param[out] height upon return contains the height of the image 00089 */ 00090 void 00091 CameraControlImage::size(unsigned int &width, unsigned int &height) 00092 { 00093 width = this->width(); 00094 height = this->height(); 00095 } 00096 00097 /** Return whether the camera image is horizontally mirrored. 00098 * @return true if the image is horizontally mirrored 00099 * @throws NotImplementedException Not implemented by this control 00100 */ 00101 bool 00102 CameraControlImage::horiz_mirror() 00103 { 00104 throw NotImplementedException("Not implemented"); 00105 } 00106 00107 00108 /** Return whether the camera image is vertically mirrored. 00109 * @return true if the image is vertically mirrored 00110 * @throws NotImplementedException Not implemented by this control 00111 */ 00112 bool 00113 CameraControlImage::vert_mirror() 00114 { 00115 throw NotImplementedException("Not implemented"); 00116 } 00117 00118 00119 /** Get information about current camera image mirroring. 00120 * @param[out] horiz upon return contains flag if horizontal mirroring is enabled 00121 * @param[out] vert upon return contains flag if vertical mirroring is enabled 00122 * @throws NotImplementedException Not implemented by this control 00123 */ 00124 void 00125 CameraControlImage::mirror(bool &horiz, bool &vert) 00126 { 00127 horiz = horiz_mirror(); 00128 vert = vert_mirror(); 00129 } 00130 00131 00132 /** Set whether the camera should mirror images horizontally. 00133 * @param enabled if true, images should be mirrored horizontally 00134 * @throws NotImplementedException Not implemented by this control 00135 */ 00136 void 00137 CameraControlImage::set_horiz_mirror(bool enabled) 00138 { 00139 throw NotImplementedException("Not implemented"); 00140 } 00141 00142 00143 /** Set whether the camera should mirror images vertically. 00144 * @param enabled if true, images should be mirrored vertically 00145 * @throws NotImplementedException Not implemented by this control 00146 */ 00147 void 00148 CameraControlImage::set_vert_mirror(bool enabled) 00149 { 00150 throw NotImplementedException("Not implemented"); 00151 } 00152 00153 00154 /** Set whether the camera should mirror images. 00155 * @param horiz true to mirror images horizontally, false to disable mirroring 00156 * @param vert true to mirror images vertically, false to disable mirroring 00157 * @throws NotImplementedException Not implemented by this control 00158 */ 00159 void 00160 CameraControlImage::set_mirror(bool horiz, bool vert) 00161 { 00162 set_horiz_mirror(horiz); 00163 set_vert_mirror(vert); 00164 } 00165 00166 00167 /** Get the number of frames per second the camera tries to deliver. 00168 * @return the current fps 00169 * @throws NotImplementedException Not implemented by this control 00170 */ 00171 unsigned int 00172 CameraControlImage::fps() 00173 { 00174 throw NotImplementedException("Not implemented"); 00175 } 00176 00177 00178 /** Set the number of frames per second the camera tries to deliver. 00179 * @param fps the new fps 00180 * @throws NotImplementedException Not implemented by this control 00181 */ 00182 void 00183 CameraControlImage::set_fps(unsigned int fps) 00184 { 00185 throw NotImplementedException("Not implemented"); 00186 } 00187 00188 00189 /** Get current lens x correction 00190 * @return current lens x correction 00191 * @throws NotImplementedException Not implemented by this control 00192 */ 00193 unsigned int 00194 CameraControlImage::lens_x_corr() 00195 { 00196 throw NotImplementedException("Not implemented"); 00197 } 00198 00199 00200 /** Get current lens y correction 00201 * @return current lens y correction 00202 * @throws NotImplementedException Not implemented by this control 00203 */ 00204 unsigned int 00205 CameraControlImage::lens_y_corr() 00206 { 00207 throw NotImplementedException("Not implemented"); 00208 } 00209 00210 00211 /** Get current lens correction 00212 * @param[out] x_corr where the current lens x correction will be stored 00213 * @param[out] y_corr where the current lens y correction will be stored 00214 * @throws NotImplementedException Not implemented by this control 00215 */ 00216 void 00217 CameraControlImage::lens_corr(unsigned int &x_corr, unsigned int &y_corr) 00218 { 00219 x_corr = this->lens_x_corr(); 00220 y_corr = this->lens_y_corr(); 00221 } 00222 00223 00224 /** Set lens x correction 00225 * @param x_corr new lens x correction 00226 * @throws NotImplementedException Not implemented by this control 00227 */ 00228 void 00229 CameraControlImage::set_lens_x_corr(unsigned int x_corr) 00230 { 00231 throw NotImplementedException("Not implemented"); 00232 } 00233 00234 00235 /** Set lens y correction 00236 * @param y_corr new lens y correction 00237 * @throws NotImplementedException Not implemented by this control 00238 */ 00239 void 00240 CameraControlImage::set_lens_y_corr(unsigned int y_corr) 00241 { 00242 throw NotImplementedException("Not implemented"); 00243 } 00244 00245 00246 /** Set lens correction 00247 * @param x_corr new lens x correction 00248 * @param y_corr new lens y correction 00249 * @throws NotImplementedException Not implemented by this control 00250 */ 00251 void 00252 CameraControlImage::set_lens_corr(unsigned int x_corr, unsigned int y_corr) 00253 { 00254 set_lens_x_corr(x_corr); 00255 set_lens_y_corr(y_corr); 00256 }

