Fawkes API  Fawkes Development Version
gradient.h
1 /***************************************************************************
2  * gradient.h - Class defining a gradient (color) classifier
3  *
4  * Created: Tue Jun 10 11:48:00 2008
5  * Copyright 2008 Christof Rath <christof.rath@gmail.com>
6  *
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version. A runtime exception applies to
13  * this software (see LICENSE.GPL_WRE file mentioned below for details).
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
21  */
22 
23 #ifndef __FIREVISION_CLASSIFIERS_GRADIENT_H_
24 #define __FIREVISION_CLASSIFIERS_GRADIENT_H_
25 
26 #include <fvclassifiers/classifier.h>
27 #include <fvclassifiers/qualifiers.h>
28 
29 #include <fvmodels/scanlines/grid.h>
30 
31 namespace firevision {
32 #if 0 /* just to make Emacs auto-indent happy */
33 }
34 #endif
35 
37 {
38  public:
39  GradientClassifier(std::list<ScanlineGrid* >* scanlines, Qualifier* q,
40  unsigned int threshold, unsigned int max_size = 0,
41  bool use_rising_flank = true,
42  bool use_falling_flank = true);
43  virtual ~GradientClassifier();
44 
45  virtual std::list< ROI > * classify();
46  virtual void set_src_buffer(unsigned char *yuv422_planar,
47  unsigned int width, unsigned int height);
48 
49  virtual void set_threshold(unsigned int threshold, unsigned int max_size = 0);
50  virtual void set_edges(bool use_rising_edge, bool use_falling_edge);
51 
52  private:
53  int _last_val;
54  fawkes::upoint_t _last_pos;
55 
56  unsigned int _threshold;
57  unsigned int _max_size;
58 
59  std::list<ScanlineGrid* >* _scanlines;
60  Qualifier* _q;
61 
62  bool _use_falling_edge;
63  bool _use_rising_edge;
64 };
65 
66 } // end namespace firevision
67 
68 #endif // __FIREVISION_CLASSIFIERS_GRADIENT_H_
GradientClassifier(std::list< ScanlineGrid * > *scanlines, Qualifier *q, unsigned int threshold, unsigned int max_size=0, bool use_rising_flank=true, bool use_falling_flank=true)
Constructor.
Definition: gradient.cpp:51
virtual std::list< ROI > * classify()
Classify image.
Definition: gradient.cpp:121
virtual void set_edges(bool use_rising_edge, bool use_falling_edge)
Edge setter.
Definition: gradient.cpp:98
virtual void set_threshold(unsigned int threshold, unsigned int max_size=0)
Threshold setter.
Definition: gradient.cpp:83
virtual ~GradientClassifier()
Destructor.
Definition: gradient.cpp:72
Point with cartesian coordinates as unsigned integers.
Definition: types.h:34
virtual void set_src_buffer(unsigned char *yuv422_planar, unsigned int width, unsigned int height)
Set source buffer.
Definition: gradient.cpp:112
Classifier to extract regions of interest.
Definition: classifier.h:37
Gradient classifier.
Definition: gradient.h:36
Abstract Qualifier for a single pixel.
Definition: qualifiers.h:34