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

autoblob_Filter.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 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 General Public License for more details.
00020 
00021     You should have received a copy of the GNU 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 _AUTOBLOB_FILTER_H
00027 #define _AUTOBLOB_FILTER_H
00028 
00029 #include <sys/time.h>
00030 #include <ImageDefinitions.h>
00031 #include <phFilter.h>
00032 #include <phautoblob.h>
00033 #include <phAutoBlobData.h>
00034 
00035 /* ------------------------------------------------------------------------ */
00036 class autoblob_Filter : public phFilter 
00037 {
00038 private:
00039     uint32_t        m_autoblob;
00040     
00041     uint32_t        m_inputFormat;
00042     uint32_t        m_outputFormat;
00043 
00044     /* This is the input to the blobbing functions */
00045     phColor        *m_incolor;
00046     uint32_t        m_incolor_size;
00047     phColor        *m_threshold;
00048     uint32_t        m_threshold_size;
00049     uint32_t        m_nColors;
00050     phColor        *m_outcolor;
00051     uint32_t        m_outcolor_size;
00052 
00053     /* Autoblobbing inputs */
00054     phColor m_lower_threshold;
00055     int32_t m_lower_thresh      [phCOLOR_MAXELEMS];
00056     phColor m_upper_threshold;
00057     int32_t m_upper_thresh      [phCOLOR_MAXELEMS];
00058     phColor m_loop_threshold;
00059     int32_t m_loop_thresh       [phCOLOR_MAXELEMS];
00060     
00061     /* options for drawing rectangles around blobs,
00062      * coloring the lines of the blobs and the minimum size
00063      * of the blobs */
00064     int             m_draw_rects;
00065     int             m_color_blobs;
00066     uint32_t        m_color_min_size;
00067 
00068     /* This is the output from the blobbing */
00069     phautoblob_data *m_data;
00070     
00071     /* This is also the args to the blob filters so all the pointers
00072      * aren't passed on the stack */
00073     phautoblob_args m_args;
00074     
00075     /* The cumulative output in a thread safe object */
00076     phAutoBlobData  m_blobData;
00077 
00078     void phColor_to_int32_array(phColor color,int32_t *array);
00079     
00080 protected:
00081 
00082     int filter();
00083 
00084 public:
00085     autoblob_Filter();
00086     
00087     /* Constuctor for nearest neighbor matching */
00088     autoblob_Filter(phColor     lower_threshold,
00089                     phColor     upper_threshold,
00090                     phColor     loop_threshold,
00091                     phColor     outcolor,
00092                     int         draw_rects      = 0,
00093                     int         color_blobs     = 0,
00094                     uint32_t    color_min_size  = 0 );
00095     
00096     /* Constructor for color/threshold array matching */
00097     autoblob_Filter(phColor    *incolor,
00098                     phColor    *threshold,
00099                     uint32_t    nColors,
00100                     phColor    *outcolor        = NULL,
00101                     int         draw_rects      = 0,
00102                     int         color_blobs     = 0,
00103                     uint32_t    color_min_size  = 0);
00104     
00105     ~autoblob_Filter();
00106 
00107     int reset();
00108     
00109     /* autoblobing set method(s) */
00110     /* Each will also set the autoblob parameter to autoblob in ::filter*/
00111     int set(phColor     lower_threshold,
00112             phColor     upper_threshold,
00113             phColor     loop_threshold );
00114 
00115     int set(phColor     lower_threshold,
00116             phColor     upper_threshold,
00117             phColor     loop_threshold,
00118             phColor     outcolor,
00119             int         draw_rects, 
00120             int         color_blobs,
00121             uint32_t    color_min_size );
00122 
00123     /* non-autoblobbing set method(s) */
00124     /* This set method will disable the autoblob parameter */
00125     int set(phColor    *incolor         = NULL,
00126             phColor    *threshold       = NULL,
00127             uint32_t    nColors         = 0,
00128             phColor    *outcolor        = NULL,
00129             int         draw_rects      = 0,
00130             int         color_blobs     = 0,
00131             uint32_t    color_min_size  = 0 );
00132 
00133     /* options for drawing information on the output */
00134     int setDrawRects    ( uint32_t draw_rects       = 0 );
00135     int setColorBlobs   ( uint32_t color_blobs      = 0 );
00136     int setColorMinSize ( uint32_t color_min_size   = 0 );
00137     int setOutcolor     ( phColor outcolor );
00138 
00139     /* For autoblobbing; set threshold information */
00140     int setAutoBlob         ( int autoblob = 1 );
00141     int setThresholds       ( phColor lower_threshold,
00142                               phColor upper_threshold,
00143                               phColor loop_threshold );
00144     int setLowerThreshold   ( phColor lower_threshold   );
00145     int setUpperThreshold   ( phColor upper_threshold   );
00146     int setLoopThreshold    ( phColor loop_threshold    );
00147     
00148     /* For non-autoblobbing; Use specific color input */
00149     int setColor        ( phColor incolor, phColor threshold );
00150     int addColor        ( phColor incolor, phColor threshold );
00151     int removeColor     ( phColor incolor, phColor threshold );
00152     int replaceColor    ( phColor old_incolor, phColor old_threshold, 
00153                           phColor new_incolor, phColor new_threshold );
00154     int removeColors    ();
00155 
00156     int getBlobData     ( phAutoBlobData &blobData );
00157     
00158     phLiveObject    *getLiveBlobOutput();
00159     
00160     phFilter        *cloneFilter();
00161 };
00162 
00163 #endif /* _AUTOBLOB_FILTER_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:06 2007 for phission by  doxygen 1.4.4