LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiFrameGrabber.h

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 .......: ltiFrameGrabber.h
00027  * authors ....: Peter Mathes
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 13.08.99
00030  * revisions ..: $Id: ltiFrameGrabber.h,v 1.6 2006/02/07 19:54:57 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_FRAMEGRABBER_H_
00034 #define _LTI_FRAMEGRABBER_H_
00035 
00036 #include "ltiFunctor.h"
00037 #include "ltiImage.h"
00038 #include "ltiHardwareConfig.h"
00039 
00040 namespace lti {
00041   /**
00042    * frame grabber class.
00043    * class for grabbing frames from cameras and
00044    * converting them to ltiImage format.
00045    */
00046   class frameGrabber : public functor {
00047   public:
00048     /**
00049      * frameGrabber parameters class
00050      */
00051     class parameters : public functor::parameters {
00052     public:
00053       /**
00054        * default constructor
00055        */
00056       parameters() : functor::parameters(),turnaround(false) {
00057       };
00058 
00059       /**
00060        * copy constructor
00061        */
00062       parameters( const parameters& other ) 
00063         : functor::parameters() {
00064         copy( other );
00065       };
00066 
00067       /**
00068        * copy member
00069        */
00070       parameters& copy( const parameters& other );
00071 
00072       /**
00073        * returns a pointer to a clone of the parameters.
00074        */
00075       virtual functor::parameters* clone() const;
00076 
00077       /**
00078        * returns the type name
00079        */
00080       virtual const char* getTypeName() const;
00081 
00082       /**
00083        * write the parameters in the given ioHandler
00084        * @param handler the ioHandler to be used
00085        * @param complete if true (the default) the enclosing begin/end will
00086        *        be also written, otherwise only the data block will be written.
00087        * @return true if write was successful
00088        */
00089       virtual bool write(ioHandler& handler,const bool complete=true) const;
00090 
00091       /**
00092        * write the parameters in the given ioHandler
00093        * @param handler the ioHandler to be used
00094        * @param complete if true (the default) the enclosing begin/end will
00095        *        be also written, otherwise only the data block will be written.
00096        * @return true if write was successful
00097        */
00098       virtual bool read(ioHandler& handler,const bool complete=true);
00099 
00100 #     ifdef _LTI_MSC_6
00101       /**
00102        * this function is required by MSVC only, as a workaround for a
00103        * very awful bug, which exists since MSVC V.4.0, and still by
00104        * V.6.0 with all bugfixes (so called "service packs") remains
00105        * there...  This method is also public due to another bug, so please
00106        * NEVER EVER call this method directly: use read() instead
00107        */
00108       bool readMS(ioHandler& handler,const bool complete=true);
00109 
00110       /**
00111        * this function is required by MSVC only, as a workaround for a
00112        * very awful bug, which exists since MSVC V.4.0, and still by
00113        * V.6.0 with all bugfixes (so called "service packs") remains
00114        * there...  This method is also public due to another bug, so please
00115        * NEVER EVER call this method directly: use write() instead
00116        */
00117       bool writeMS(ioHandler& handler,const bool complete=true) const;
00118 #     endif
00119 
00120 
00121       /**
00122        * If true, the grabber will flip the image before it is
00123        * returned to the caller. This is useful for upside-down mounted
00124        * cameras.
00125        */
00126       bool turnaround;
00127 
00128     };
00129 
00130     /**
00131      * class for frame grabber exceptions
00132      */
00133     class frameGrabberException : public lti::exception {
00134     public:
00135       /**
00136        * default constructor
00137        */
00138       frameGrabberException(const char* msg = "frame grabber exception")
00139         : lti::exception(msg) {
00140       };
00141     };
00142 
00143     /**
00144      * default constructor
00145      */
00146     frameGrabber() 
00147       : functor() {};
00148 
00149     /**
00150      * copy constructor
00151      */
00152     frameGrabber(const frameGrabber& other);
00153 
00154     /**
00155      * constructor, sets the parameters
00156      */
00157     frameGrabber(const parameters& theParam);
00158 
00159     /**
00160      * destructor
00161      */
00162     virtual ~frameGrabber( void );
00163 
00164     /**
00165      * returns current parameters.
00166      */
00167     const parameters& getParameters() const;
00168 
00169     /**
00170      * returns the name of this type
00171      */
00172     virtual const char* getTypeName() const;
00173 
00174     /**
00175      * load an (color) image from the grabber
00176      */
00177     virtual bool apply(image& theImage)=0;
00178 
00179     /**
00180      * load a grey value channel from the
00181      */
00182     virtual bool apply(channel8& theChannel)=0;
00183 
00184     /**
00185      * load a grey value channel from the
00186      */
00187     virtual bool apply(channel& theChannel);
00188 
00189     /**
00190      * check if the frame grabber / camera system is active
00191      */
00192     virtual bool isActive() const;
00193 
00194     /**
00195      * initialize frame grabber
00196      * @return true if successful, false otherwise
00197      */
00198     virtual bool init() = 0;
00199 
00200     /**
00201      * copy member
00202      */
00203     frameGrabber& copy(const frameGrabber& other);
00204   };
00205 }
00206 
00207 #endif

Generated on Sat Apr 10 15:25:32 2010 for LTI-Lib by Doxygen 1.6.1