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 #include <fvmodels/scanlines/grid.h>
29 
30 namespace firevision {
31 
32 class GradientClassifier : public Classifier
33 {
34 public:
35  GradientClassifier(std::list<ScanlineGrid *> *scanlines,
36  Qualifier * q,
37  unsigned int threshold,
38  unsigned int max_size = 0,
39  bool use_rising_flank = true,
40  bool use_falling_flank = true);
41  virtual ~GradientClassifier();
42 
43  virtual std::list<ROI> *classify();
44  virtual void
45  set_src_buffer(unsigned char *yuv422_planar, unsigned int width, unsigned int height);
46 
47  virtual void set_threshold(unsigned int threshold, unsigned int max_size = 0);
48  virtual void set_edges(bool use_rising_edge, bool use_falling_edge);
49 
50 private:
51  int _last_val;
52  fawkes::upoint_t _last_pos;
53 
54  unsigned int _threshold;
55  unsigned int _max_size;
56 
57  std::list<ScanlineGrid *> *_scanlines;
58  Qualifier * _q;
59 
60  bool _use_falling_edge;
61  bool _use_rising_edge;
62 };
63 
64 } // end namespace firevision
65 
66 #endif // FIREVISION_CLASSIFIERS_GRADIENT_H__
firevision::GradientClassifier::set_threshold
virtual void set_threshold(unsigned int threshold, unsigned int max_size=0)
Threshold setter.
Definition: gradient.cpp:83
firevision::GradientClassifier::classify
virtual std::list< ROI > * classify()
Definition: gradient.cpp:122
firevision::GradientClassifier::set_src_buffer
virtual void set_src_buffer(unsigned char *yuv422_planar, unsigned int width, unsigned int height)
Set source buffer.
Definition: gradient.cpp:112
fawkes::upoint_t
Point with cartesian coordinates as unsigned integers.
Definition: types.h:33
firevision::GradientClassifier::~GradientClassifier
virtual ~GradientClassifier()
Destructor.
Definition: gradient.cpp:72
firevision::Qualifier
Definition: qualifiers.h:34
firevision::GradientClassifier::GradientClassifier
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:49
firevision::GradientClassifier::set_edges
virtual void set_edges(bool use_rising_edge, bool use_falling_edge)
Edge setter.
Definition: gradient.cpp:98