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

phSimpleVision.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 _PHSIMPLEVISION_H
00027 #define _PHSIMPLEVISION_H
00028 
00029 /*
00030  * \file phSimpleVision.h
00031  * This file contains the definitions for the phSimpleVision class.
00032  * \todo finish documenting and make sure this is formated correctly
00033  */
00034 #include <phStdint.h>
00035 
00036 #include <phImage.h>
00037 #include <phImageCapture.h>
00038 #include <phDisplayInterface.h>
00039 
00040 #include <phFilter.h>
00041 
00042 #include <blob_Filter.h>
00043 #include <histogram_Filter.h>
00044 
00045 #include <phPipeline.h>
00046 
00047 #include <phSystem.h>
00048 
00049 /* ------------------------------------------------------------------------- */
00055 /* ------------------------------------------------------------------------- */
00062 #define phSimpleVisionOutput_Capture      0
00063 
00069 #define phSimpleVisionOutput_Pipeline     1
00070 
00071 #define phSVO_Capture  phSimpleVisionOutput_Capture
00072 
00073 #define phSVO_Pipeline phSimpleVisionOutput_Pipeline
00074 
00084 #define phSimpleVision_Stopped 1
00085 
00086 #define phSimpleVision_Started 2
00087 
00088 #define phSimpleVision_Paused  3
00089 
00096 #define phSimpleVision_HSV 0
00097 
00102 #define phSimpleVision_RGB 1
00103 
00111 #define phSimpleVision_NOUPDATE phLiveObjectNOUPDATE
00112 
00118 #define phSimpleVision_UPDATED  phLiveObjectUPDATED
00119 
00126 #define phSimpleVision_ADD 1
00127 
00133 #define phSimpleVision_SET 2
00134 
00135 /* ------------------------------------------------------------------------- */
00423 PHAPI(class) phSimpleVision : public phMutex
00424 {
00425 private:
00426     phImageCapture     *m_capture;
00427     phPipeline         *m_pipeline;
00428     phDisplayInterface **m_displays;
00429     phSystem           *m_system;
00430  
00431     int                *m_displaysEnabled;
00432 
00433     int                 m_state;
00434     /* Filter stuff */
00435     phFilter           **m_filters;
00436 
00437     int                 m_emptyIndex;
00438     int                 m_motionIndex;
00439     int                 m_cannyIndex;
00440     int                 m_sobelIndex;
00441     int                 m_gaussianIndex;
00442     int                 m_meanIndex;
00443     int                 m_medianIndex;
00444     int                 m_inverseIndex;
00445     int                 m_thresholdIndex;
00446     int                 m_addIndex;
00447     int                 m_subtractIndex;
00448     int                 m_blobIndex;
00449     int                 m_histIndex;
00450     int                 m_RGBIndex;
00451     int                 m_HSVIndex;
00452     
00453     phHistogramData    *m_histData;
00454     phColor             m_trainedColor;
00455     phColor             m_trainedThreshold;
00456     
00457     phBlobData         *m_blobData;
00458     phColor             m_blobOutcolor;
00459     int32_t             m_blobMinsize;
00460     float               m_blobMinPercentage;
00461     phblob              m_maxBlob;
00462     
00463     int stopAndEmptyPipeline();
00464     int switchToFilters( int *indexes, int count );
00465     int switchToFilter( int index );
00466     
00467     int initHistogramSettings( );
00468     int initBlobSettings( );
00469     
00470     int private_tracking( int which );
00471     int private_training( int which );
00472     
00473 public:
00474     phSimpleVision( );
00475     ~phSimpleVision( );
00476 
00477     /* Capture methods - default is "/dev/video0" */
00478 
00490     int         setPath             ( const char *path );
00496     const char *getPath             ( );
00509     int         setChannel          ( uint32_t channel );
00515     uint32_t    getChannel          ( );
00516     
00517     /* NetDisplay methods - disabled by default */
00518 
00532     int         enableNetDisplay    ( int which = -1 );
00543     int         disableNetDisplay   ( int which = -1 );
00554     int         isNetEnabled        ( int which = -1 );
00566     int         setPort             ( uint32_t port );
00567 
00568     /* X11Display methods - enabled by default */
00569     
00580     int         enableDisplay       ( int which = -1 );
00592     int         disableDisplay      ( int which = -1 );
00604     int         isDisplayEnabled    ( int which = -1 );
00605 
00606     /* phSimpleVision control methods */
00607 
00618     int         start   ( );
00629     int         pause   ( );
00637     int         stop    ( );
00638 
00647     int         isStarted();
00656     int         isPaused( );
00665     int         isStopped();
00666 
00667     /* --------------------------------------------------------------------- */
00668     /* phSimpleVision/phFilter/phPipeline processing methods */
00669     /* --------------------------------------------------------------------- */
00670 
00671 
00672     /* --------------------------------------------------------------------- */
00673     /* Individual filters - runs specific filter on image to show what output*
00674      *                      looks like after filter is run                   */
00683     int         empty               ( );
00693     int         motion              ( );
00703     int         canny               ( );
00711     int         sobel               ( );
00720     int         gaussian            ( );
00729     int         mean                ( );
00738     int         median              ( );
00748     int         inverse             ( );
00759     int         threshold           ( );
00771     int         add                 ( uint32_t nFrames      = 2, 
00772                                       uint32_t frame_step   = 1);
00781     int         subtract            ( );
00782    
00783     /* --------------------------------------------------------------------- */
00784     /* Histogramming - color training methods */
00799     int             trainingRGB         ( );
00815     int             trainingHSV         ( );
00866     int             train               ( int colorspace = -1,
00867                                           int add_or_set = -1 );
00880     int             trainSet            ( int colorspace = -1 );
00899     int             trainAdd            ( int colorspace = -1 );
00904     phColor         getColor            ( );             
00909     phColor         getThreshold        ( );             
00922     int             setColor            ( phColor color );             
00932     int             setThreshold        ( phColor threshold );             
00947     int             applyTraining       ( int add_or_set );
00948 
00949     
00950     /* --------------------------------------------------------------------- */
00951     /* Blobbing - color tracking methods */
00965     int         trackingHSV         ( );
00979     int         trackingRGB         ( );
01012     int         track               ( int colorspace = -1 );
01020     uint32_t    getBlobCount        ( );
01031     uint32_t    getBlobCount        ( uint32_t minsize );
01040     phblob      getMaxBlob          ( );
01044     int         resetTrackingData   ( );
01045     
01046     /* --------------------------------------------------------------------- */
01047     /* The following function should only be used if you know how to use
01048      * the objects being returned. Finer control over the classes is possible
01049      * by retreiving a direct pointer to the object. While this may break
01050      * encapsulation, it can be very convenient */
01051     
01052     /* Return the blob/histogram filters:
01053      *      This allows finer control over what the filter's do by allowing
01054      *  the user to control colors/rectangles/etc. 
01055      */
01062     blob_Filter        *getBlobFilter       ( );
01071     phBlobData         &getBlobData         ( );
01076     histogram_Filter   *getHistogramFilter  ( );
01084     phHistogramData    &getHistogramData    ( );
01085     
01086     /* Returns the system in which all the following are contained */
01100     phSystem           *getSystem           ( );
01101     
01102     /* Retrieve the capture class */
01115     phImageCapture     *getCapture          ( );
01116 
01117     /* Return the pipeline instance */
01133     phPipeline         *getPipeline         ( );
01134     
01135     /* Retrieve the display classes */
01149     phDisplayInterface *getDisplay          ( int which );
01166     NetDisplay         *getNetDisplay       ( int which );
01167 };
01168  /* end \ingroup VisionClasses */
01170 
01171 #endif /* _PHSIMPLEVISION_H */
01172 
01173 




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:11 2007 for phission by  doxygen 1.4.4