Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

phImageCapture.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002     Phission : 
00003         Realtime Vision Processing System
00004     
00005     Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu)
00006     University of Massachusetts at Lowell,
00007     Laboratory for Artificial Intelligence and Robotics
00008     
00009     This file is part of Phission.
00010 
00011     Phission is free software; you can redistribute it and/or modify
00012     it under the terms of the GNU Lesser General Public License as published by
00013     the Free Software Foundation; either version 2 of the License, or
00014     (at your option) any later version.
00015 
00016     Phission is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU Lesser General Public License for more details.
00020 
00021     You should have received a copy of the GNU Lesser General Public License
00022     along with Phission; if not, write to the Free Software
00023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025  ---------------------------------------------------------------------------*/
00026 #ifndef _PHIMAGECAPTURE_H
00027 #define _PHIMAGECAPTURE_H
00028 
00029 #include <phStdint.h>
00030 #include <phInt32Array.h>
00031 #include <phMutex.h>
00032 #include <phImage.h>
00033 #include <phCaptureInterface.h>
00034 
00040 /* ---------------------------------------------------------------------- */
00041 #define phCHANGE_BRIGHTNESS 1
00042 #define phCHANGE_HUE        2
00043 #define phCHANGE_COLOR      3
00044 #define phCHANGE_CONTRAST   4
00045 #define phCHANGE_WHITENESS  5
00046 
00047 #define phCHANGE_FORMAT     6
00048 #define phCHANGE_WIDTH      7
00049 #define phCHANGE_HEIGHT     8
00050 
00051 #define phCHANGE_PATH       9
00052 
00053 #define phCHANGE_CHANNEL    10
00054 
00055 #define phCHANGE_TUNER      12
00056 
00057 /* ---------------------------------------------------------------------- */
00058 /*  phCHANGE_BRIGHTNESS, phCHANGE_HUE, phCHANGE_COLOR, phCHANGE_CONTRAST,
00059     phCHANGE_WHITENESS,  phCHANGE_FORMAT, phCHANGE_WIDTH, phCHANGE_HEIGHT
00060     phCHANGE_PATH, phCHANGE_CHANNEL, phCHANGE_TUNER */
00061 #define phCHANGE_INIT       11
00062 
00063 /* ---------------------------------------------------------------------- */
00064 /* phCHANGE_BRIGHTNESS, phCHANGE_HUE, phCHANGE_COLOR, phCHANGE_CONTRAST,
00065    phCHANGE_WHITENESS */
00066 //#define phCHANGE_IMAGE_SETTING 12
00067 
00068 /* ---------------------------------------------------------------------- */
00069 /* phCHANGE_FORMAT, phCHANGE_WIDTH, phCHANGE_HEIGHT */
00070 //#define phCHANGE_IMAGE_DIMENSION 13
00071 
00072 #define phCHANGE_END phCHANGE_INIT
00073  /* end \addtogroup Capture */
00075 
00076 /* ---------------------------------------------------------------------- */
00082 PHAPI(class) phImageCapture : public phCaptureInterface
00083 {
00084 private:
00085     int         m_defer_apply;
00086     
00087     phImage     *m_imageOutput;
00088     
00089 protected:
00090     /* protected by the m_settings_lock */
00091     ph_int32_array m_changed_array;
00092     
00093     int         m_brightness;
00094     int         m_hue;
00095     int         m_color;
00096     int         m_contrast;
00097     int         m_whiteness;
00098     uint32_t    m_format;
00099     int         m_width;
00100     int         m_height;
00101     int         m_depth;
00102     int         m_image_size;
00103     int         m_channel;
00104     
00105     virtual int onApplySettings();
00106     int applySettings();
00107     
00108 public:
00109     phImageCapture();
00110     virtual ~phImageCapture();
00111     
00112     virtual int setPath( const char *path );
00113 
00114     /* These methods should not be overloaded. applySettings will be
00115      * called when the application of the settings is ready to be done.
00116      * These methods acquire/release a lock and set up the m_changed 
00117      * variable along with the object's value for each setting 
00118      */
00119     int setChannel      ( int channelNumber = -1 );
00120     int setPicture      ( int brightness = -1,
00121                           int hue        = -1,
00122                           int color      = -1,
00123                           int contrast   = -1,
00124                           int whiteness  = -1,
00125                           uint32_t format= phImageNOFORMAT );
00126     int setBrightness   ( int value );
00127     int setHue          ( int value );
00128     int setColor        ( int value );
00129     int setContrast     ( int value );
00130     int setWhiteness    ( int value );
00131     int setFormat       ( uint32_t format );
00132 
00133     int set             ( int        width       = -1, 
00134                           int        height      = -1, 
00135                           char       *path       = NULL,
00136                           int        channel     = -1,
00137                           int        brightness  = -1,
00138                           int        hue         = -1,
00139                           int        color       = -1,
00140                           int        contrast    = -1,
00141                           int        whiteness   = -1,
00142                           uint32_t   format      = phImageNOFORMAT );
00143     
00144     int setSize         ( int width, 
00145                           int height ); 
00146     
00147     /* For the British */
00148     int getColour();
00149     int setColour( int value );
00150     
00151     /* Returns a pointer to the private m_imageOutput that
00152      * was allocated in the constructor */
00153     phImage *getImage();
00154     
00155     /* the retreiving of the settings are done by use of
00156      * virtual methods. This allows an inheriting class to overload
00157      * these methods when the application or retrieval of a setting
00158      * is either defered or not valid for the given capture class */
00159     virtual int         getChannel      ();
00160     virtual int         getBrightness   ();
00161     virtual int         getHue          ();
00162     virtual int         getColor        ();
00163     virtual int         getContrast     ();
00164     virtual int         getWhiteness    ();
00165     virtual int         getWidth        ();
00166     virtual int         getHeight       ();
00167     virtual int32_t     getFormat       ();
00168     virtual uint32_t    getImageSize    ();
00169  
00170     virtual int         getMaxBrightness();
00171     virtual int         getMaxHue       ();
00172     virtual int         getMaxColor     ();
00173     virtual int         getMaxContrast  ();
00174     virtual int         getMaxWhiteness ();
00175     virtual int         getMaxWidth     ();
00176     virtual int         getMaxHeight    ();
00177     
00178     /* This can be overloaded if there is more to copying 
00179      * the image from the capture class */
00180     virtual int         copyImage( phImage &copyto,
00181                                    int      wait = 1 );
00182    
00183     virtual int open    ( char *deviceName = NULL );
00184     virtual int close   ();
00185     virtual int isOpen  ();
00186 };
00187 
00188 #endif /* _PHIMAGECAPTURE_H */




Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:01 2007 for phission by  doxygen 1.4.4