Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
drwnSegImageRegionFeatures.h
1 /*****************************************************************************
2 ** DARWIN: A FRAMEWORK FOR MACHINE LEARNING RESEARCH AND DEVELOPMENT
3 ** Distributed under the terms of the BSD license (see the LICENSE file)
4 ** Copyright (c) 2007-2015, Stephen Gould
5 ** All rights reserved.
6 **
7 ******************************************************************************
8 ** FILENAME: drwnSegImageRegionFeatures.h
9 ** AUTHOR(S): Stephen Gould <stephen.gould@anu.edu.au>
10 **
11 *****************************************************************************/
12 
13 #pragma once
14 
15 #include <cstdlib>
16 #include <cassert>
17 #include <vector>
18 #include <list>
19 
20 #include "Eigen/Core"
21 
22 #include "drwnBase.h"
23 #include "drwnIO.h"
24 #include "drwnML.h"
25 
26 using namespace std;
27 using namespace Eigen;
28 
29 // forward declarations ----------------------------------------------------
30 
32 
33 // drwnSegImageRegionFeatures class ----------------------------------------
39 
41  protected:
42  string _instanceName;
44 
45  public:
46  drwnSegImageRegionFeatures() : _instanceRegions(0)
47  { /* do nothing */ }
49  _instanceName(f._instanceName), _instanceRegions(f._instanceRegions)
50  { /* do nothing */ }
51  virtual ~drwnSegImageRegionFeatures() { /* do nothing */ }
52 
53  drwnSegImageRegionFeatures *clone() const = 0;
54 
56  virtual int numFeatures() const = 0;
57 
59  virtual void cacheInstanceData(const drwnSegImageInstance& instance);
61  virtual void clearInstanceData();
62 
64  virtual void appendRegionFeatures(int regId, vector<double>& phi) const = 0;
65 };
66 
67 // drwnSegImageStdRegionFeatures class -------------------------------------
70 
72  public:
73  // configurable feature options
74  static double FILTER_BANDWIDTH;
75 
76  protected:
78 
79  public:
80  drwnSegImageStdRegionFeatures() { /* do nothing */ }
82  virtual ~drwnSegImageStdRegionFeatures() { /* do nothing */ }
83 
85  return new drwnSegImageStdRegionFeatures(*this);
86  }
87 
88  // data caching
89  void cacheInstanceData(const drwnSegImageInstance& instance);
90  void clearInstanceData();
91 
92  // feature computation
93  int numFeatures() const;
94  void appendRegionFeatures(int regId, vector<double>& phi) const;
95 };
string _instanceName
name of the chached instance (for error reporting)
Definition: drwnSegImageRegionFeatures.h:42
Encapsulates a single instance of an image for multi-class pixel labeling problems (i...
Definition: drwnSegImageInstance.h:47
static double FILTER_BANDWIDTH
bandwidth for filter features
Definition: drwnSegImageRegionFeatures.h:74
Standard per-region filterbank features computes mean and standard deviation of drwnTextonFilterBank ...
Definition: drwnSegImageRegionFeatures.h:71
Holds the results of running an image through a bank of filters and allows for computation of feature...
Definition: drwnFilterBankResponse.h:60
interface for cloning object (i.e., virtual copy constructor)
Definition: drwnInterfaces.h:36
drwnSegImageStdRegionFeatures * clone() const
returns a copy of the class usually implemented as virtual Foo* clone() { return new Foo(*this); } ...
Definition: drwnSegImageRegionFeatures.h:84
Interface for generating per-region (or per-superpixel) features for a drwnSegImageInstance object...
Definition: drwnSegImageRegionFeatures.h:40
int _instanceRegions
number of superpixels in the cached instance
Definition: drwnSegImageRegionFeatures.h:43
drwnFilterBankResponse _filters
pixel filter responses
Definition: drwnSegImageRegionFeatures.h:77