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

blob_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 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 _BLOB_FILTER_H
00027 #define _BLOB_FILTER_H
00028 
00034 #include <ImageDefinitions.h>
00035 #include <phFilter.h>
00036 #include <phblob.h>
00037 #include <phBlobData.h>
00038 
00044 /* ------------------------------------------------------------------------- */
00070 PHAPI(class) blob_Filter : public phFilter 
00071 {
00072 private:
00073     uint32_t        m_neighborblob;
00074     
00075     uint32_t        m_inputFormat;
00076     uint32_t        m_outputFormat;
00077 
00078     /* This is the input to the blobbing functions */
00079     phColor        *m_incolor;
00080     uint32_t        m_incolor_size;
00081     phColor        *m_threshold;
00082     uint32_t        m_threshold_size;
00083     uint32_t        m_nColors;
00084     phColor        *m_outcolor;
00085     uint32_t        m_outcolor_size;
00086 
00087     /* Autoblobbing inputs */
00088     phColor m_lower_threshold;
00089     int32_t m_lower_thresh      [phCOLOR_MAXELEMS];
00090     phColor m_upper_threshold;
00091     int32_t m_upper_thresh      [phCOLOR_MAXELEMS];
00092     phColor m_loop_threshold;
00093     int32_t m_loop_thresh       [phCOLOR_MAXELEMS];
00094     
00095     /* options for drawing rectangles around blobs,
00096      * coloring the lines of the blobs and the minimum size
00097      * of the blobs */
00098     int             m_draw_rects;
00099     int             m_color_blobs;
00100     uint32_t        m_color_min_size;
00101 
00102     /* This is the output from the blobbing */
00103     phblob_data *m_data;
00104     
00105     /* This is also the arguments to the blob filters so all the pointers
00106      * aren't passed on the stack */
00107     phblob_args m_args;
00108     
00109     /* The cumulative output in a thread safe object */
00110     phBlobData  m_blobData;
00111 
00112     void phColor_to_int32_array(phColor color,int32_t *array);
00113     
00114 protected:
00115 
00116     int filter();
00117 
00118 public:
00119     blob_Filter();
00120     
00121     /* Constuctor for nearest neighbor matching */
00122     blob_Filter(phColor     lower_threshold,
00123                 phColor     upper_threshold,
00124                 phColor     loop_threshold,
00125                 phColor     outcolor,
00126                 int         draw_rects      = 0,
00127                 int         color_blobs     = 0,
00128                 uint32_t    color_min_size  = 0 );
00129     
00130     /* Constructor for color/threshold array matching */
00131     blob_Filter(phColor    *incolor,
00132                 phColor    *threshold,
00133                 uint32_t    nColors,
00134                 phColor    *outcolor        = NULL,
00135                 int         draw_rects      = 0,
00136                 int         color_blobs     = 0,
00137                 uint32_t    color_min_size  = 0);
00138     
00139     ~blob_Filter();
00140 
00141     int reset();
00142     
00143     /* neighborblobing set method(s) */
00144     /* Each will also set the neighborblob parameter to neighborblob in ::filter*/
00145     int set(phColor     lower_threshold,
00146             phColor     upper_threshold,
00147             phColor     loop_threshold );
00148 
00149     int set(phColor     lower_threshold,
00150             phColor     upper_threshold,
00151             phColor     loop_threshold,
00152             phColor     outcolor,
00153             int         draw_rects, 
00154             int         color_blobs,
00155             uint32_t    color_min_size );
00156 
00157     /* non-neighborblobbing set method(s) */
00158     /* This set method will disable the neighborblob parameter */
00159     int set(phColor    *incolor         = NULL,
00160             phColor    *threshold       = NULL,
00161             uint32_t    nColors         = 0,
00162             phColor    *outcolor        = NULL,
00163             int         draw_rects      = 0,
00164             int         color_blobs     = 0,
00165             uint32_t    color_min_size  = 0 );
00166 
00167     /* options for drawing information on the output */
00168     int setDrawRects    ( uint32_t draw_rects       = 0 );
00169     int setColorBlobs   ( uint32_t color_blobs      = 0 );
00170     int setColorMinSize ( uint32_t color_min_size   = 0 );
00171     int setOutcolor     ( phColor outcolor );
00172 
00173     /* For neighborblobbing; set threshold information */
00174     int setNeighborBlob     ( int neighborblob = 1 );
00175     int setThresholds       ( phColor lower_threshold,
00176                               phColor upper_threshold,
00177                               phColor loop_threshold );
00178     int setLowerThreshold   ( phColor lower_threshold   );
00179     int setUpperThreshold   ( phColor upper_threshold   );
00180     int setLoopThreshold    ( phColor loop_threshold    );
00181     
00182     /* For non-neighborblobbing; Use specific color input */
00183     int setColor        ( phColor incolor, phColor threshold );
00184     int addColor        ( phColor incolor, phColor threshold );
00185     int removeColor     ( phColor incolor, phColor threshold );
00186     int replaceColor    ( phColor old_incolor, phColor old_threshold, 
00187                           phColor new_incolor, phColor new_threshold );
00188     int removeColors    ();
00189 
00190     int getBlobData     ( phBlobData &blobData );
00191     
00192     phLiveObject *getLiveBlobOutput();
00193     
00194     phFilter *cloneFilter();
00195 };
00196  /* ImageProcessing */
00198 
00199 #endif /* _BLOB_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:08 2007 for phission by  doxygen 1.4.4