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