latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 00003 * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany 00004 * 00005 * This file is part of the LTI-Computer Vision Library (LTI-Lib) 00006 * 00007 * The LTI-Lib is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License (LGPL) 00009 * as published by the Free Software Foundation; either version 2.1 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * The LTI-Lib is distributed in the hope that it will be 00013 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00014 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with the LTI-Lib; see the file LICENSE. If 00019 * not, write to the Free Software Foundation, Inc., 59 Temple Place - 00020 * Suite 330, Boston, MA 02111-1307, USA. 00021 */ 00022 00023 00024 /*---------------------------------------------------------------- 00025 * project ....: LTI Digital Image/Signal Processing Library 00026 * file .......: ltiQuickCam.h 00027 * authors ....: Peter Mathes 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 13.08.99 00030 * revisions ..: $Id: ltiQuickCam.h,v 1.6 2006/02/08 12:07:20 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_QUICKCAM_H_ 00034 #define _LTI_QUICKCAM_H_ 00035 00036 #include "ltiHardwareConfig.h" 00037 00038 #ifdef _USE_QUICKCAM_GRABBER 00039 00040 #include "ltiFrameGrabber.h" 00041 #include "ltiImage.h" 00042 00043 // Unix systems implementation 00044 #ifdef __linux__ 00045 00046 #include <unistd.h> 00047 00048 #include <cstdio> 00049 #include <cstdlib> 00050 #include <cstring> 00051 00052 #include <camera.h> 00053 #include <imager.h> 00054 #include <rcfile.h> 00055 00056 namespace lti { 00057 00058 /** 00059 * class to access the quick cam camera system (for LINUX only!) 00060 */ 00061 class quickCam : public frameGrabber { 00062 public: 00063 00064 /** 00065 * parameters for the quick-cam functor 00066 */ 00067 class parameters : public frameGrabber::parameters { 00068 public: 00069 00070 /** 00071 * constructor 00072 */ 00073 parameters(); 00074 00075 /** 00076 * copy member 00077 */ 00078 parameters& copy( const parameters& other ); 00079 00080 /** 00081 * copy constructor 00082 */ 00083 parameters( const parameters& other ) 00084 : frameGrabber::parameters() { 00085 copy( other ); 00086 }; 00087 00088 /** 00089 * returns a pointer to a clone of the parameters. 00090 */ 00091 virtual functor::parameters* clone() const; 00092 00093 /** 00094 * returns name of this class 00095 */ 00096 virtual const char* getTypeName() const; 00097 00098 // the parameters --------------------------------------------- 00099 00100 /** 00101 * which port to find the camera on (0 = probe 0x378, 0x278, and 0x3bc) 00102 */ 00103 int cameraPort; 00104 00105 /** which detection mode to use (see camera.h for details) 00106 - 0 = no detection 00107 - 1 = okay if either succeeds (default) 00108 - 2 = try Patrick's scheme only 00109 - 3 = try Kenny's scheme only 00110 - 4 = okay only if both schemes succeed 00111 - 2 and 3 are faster than 1, but are less likely to succeed. 00112 - Is 4 even worth having? :) 00113 */ 00114 int detectionMode; 00115 00116 /** automatically adjust brightness and color balance on startup? 00117 - 1=yes, 00118 - 0=no 00119 */ 00120 int autoAdjust; 00121 00122 /** 00123 * use 24 or 32 bits per pixel? 00124 */ 00125 int bpp; 00126 00127 /** 00128 * use 1:1, 2:1, or 4:1 decimation bits per pixel? 00129 */ 00130 int decimation; 00131 00132 /** set it if you want auto-despeckling. Despeckling can cause a very 00133 small amount of blurring in some pictures. (Better than the speckles, 00134 I promise :) 00135 - 1=yes, 00136 - 0=no 00137 */ 00138 int despeckleMode; 00139 00140 int x, y; 00141 }; 00142 00143 /** 00144 * default constuctor 00145 */ 00146 quickCam(); 00147 00148 /** 00149 * construct, set parameters and initialize frame grabber 00150 */ 00151 quickCam(const quickCam::parameters& theParams); 00152 00153 /** 00154 * destructor 00155 */ 00156 virtual ~quickCam( void ); 00157 00158 /** 00159 * returns the current parameters 00160 */ 00161 const quickCam::parameters& quickCam::getParameters() const; 00162 00163 /** 00164 * returns the name of this type 00165 */ 00166 virtual const char* getTypeName( void ) const; 00167 00168 /** 00169 * returns a pointer to a clone of the functor. 00170 */ 00171 virtual functor* clone() const; 00172 00173 bool setParameters( const functor::parameters& theParams ); 00174 00175 /** 00176 * inits the cam 00177 * @return true if successful, false otherwise 00178 */ 00179 bool init(); 00180 00181 /** 00182 * check if the quick cam is active 00183 */ 00184 bool isActive() const; 00185 00186 00187 /** 00188 * get frame 00189 */ 00190 bool apply( image& theImage ); 00191 00192 bool apply(channel8& theChannel); 00193 00194 bool apply(channel& theChannel); 00195 00196 private: 00197 00198 // which detection mode to use (see camera.h for details) 00199 // 0 = no detection 00200 // 1 = okay if either succeeds (default) 00201 // 2 = try Patrick's scheme only 00202 // 3 = try Kenny's scheme only 00203 // 4 = okay only if both schemes succeed 00204 // 2 and 3 are faster than 1, but are less likely to succeed. Is 4 even 00205 // worth having? :) 00206 int detectionMode; 00207 00208 // which port to find the camera on (0 = probe 0x378, 0x278, and 0x3bc) 00209 // int cameraPort; 00210 // 00211 // automatically adjust brightness and color balance on startup? 00212 // 1=yes, 0=no 00213 // int auto_adjust; 00214 // 00215 // use 24 or 32 bits per pixel? 00216 // int bpp; 00217 // 00218 // use 1:1, 2:1, or 4:1 decimation bits per pixel? 00219 // int decimation; 00220 // 00221 // set it if you want auto-despeckling. Despeckling can cause a very 00222 // small amount of blurring in some pictures. (Better than the speckles, 00223 // I promise :) 1=yes, 0=no 00224 // int despeckle_mode; 00225 // 00226 int upperBound, lowerBound; 00227 00228 camera_t *camera; 00229 00230 /** 00231 * frame size x 00232 */ 00233 int xSize; 00234 00235 /** 00236 * frame width 00237 */ 00238 int width; 00239 00240 /** 00241 * frame size y 00242 */ 00243 int ySize; 00244 00245 /** 00246 * frame height 00247 */ 00248 int height; 00249 00250 }; 00251 } //namespace lti 00252 00253 #endif // Unix systems 00254 00255 #endif // _USE_QUICKCAM_GRABBER 00256 00257 #endif // _LTI_QUICKCAM_H_