Fawkes API  Fawkes Development Version
gradient.h
00001 /***************************************************************************
00002  *  gradient.h - Class defining a gradient (color) classifier
00003  *
00004  *  Created: Tue Jun 10 11:48:00 2008
00005  *  Copyright  2008 Christof Rath <christof.rath@gmail.com>
00006  *
00007  ****************************************************************************/
00008 
00009 /*  This program is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version. A runtime exception applies to
00013  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00021  */
00022 
00023 #ifndef __FIREVISION_CLASSIFIERS_GRADIENT_H_
00024 #define __FIREVISION_CLASSIFIERS_GRADIENT_H_
00025 
00026 #include <fvclassifiers/classifier.h>
00027 #include <fvclassifiers/qualifiers.h>
00028 
00029 #include <fvmodels/scanlines/grid.h>
00030 
00031 namespace firevision {
00032 #if 0 /* just to make Emacs auto-indent happy */
00033 }
00034 #endif
00035 
00036 class GradientClassifier: public Classifier 
00037 {
00038  public:
00039   GradientClassifier(std::list<ScanlineGrid* >* scanlines, Qualifier* q,
00040                      unsigned int threshold, unsigned int max_size = 0, 
00041                      bool use_rising_flank = true, 
00042                      bool use_falling_flank = true);
00043   virtual ~GradientClassifier();
00044 
00045   virtual std::list< ROI > * classify();
00046   virtual void set_src_buffer(unsigned char *yuv422_planar,
00047                               unsigned int width, unsigned int height);
00048 
00049   virtual void set_threshold(unsigned int threshold, unsigned int max_size = 0);
00050   virtual void set_edges(bool use_rising_edge, bool use_falling_edge);
00051 
00052  private:
00053   int             _last_val;
00054   fawkes::point_t _last_pos;
00055 
00056   unsigned int _threshold;
00057   unsigned int _max_size;
00058 
00059   std::list<ScanlineGrid* >* _scanlines;
00060   Qualifier* _q;
00061 
00062   bool _use_falling_edge;
00063   bool _use_rising_edge;
00064 };
00065 
00066 } // end namespace firevision
00067 
00068 #endif // __FIREVISION_CLASSIFIERS_GRADIENT_H_