Loading...
Searching...
No Matches
ClassifierEMStrategy.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/rp/ClassifierEMStrategy.h
22
23 \brief EM (Expectation-Maximization) strategy for pixel-based classification.
24*/
25
26#ifndef __TERRALIB_RP_INTERNAL_CLASSIFIEREMSTRATEGY_H
27#define __TERRALIB_RP_INTERNAL_CLASSIFIEREMSTRATEGY_H
28
29// TerraLib
30#include "ClassifierStrategy.h"
32#include "Config.h"
33
34// STL
35#include <vector>
36
37// Boost
38#include <boost/numeric/ublas/matrix.hpp>
39
40namespace te
41{
42 namespace rp
43 {
44 class AlgorithmParametersSerializer;
45
46 /*!
47 \class ClassifierEMStrategy
48
49 \brief EM strategy for pixel-based classification. This is an unsupervised
50 and pixel-based classification algorithm. Expectation-Maximization (EM) works
51 iteratively by applying two steps: the E-step (Expectation) and the M-step
52 (Maximization). The method aims to approximate the parameter estimates to
53 real data distribution, along the iterations:
54 1. The E-step calculates the conditional expectation of the complete a
55 posteriori probability function.
56 2. The M-step updates the parameter estimation.
57
58 \ingroup rp_class
59 */
61 {
62 public:
63
64 /*!
65 \class Parameters
66
67 \brief Classifier Parameters
68 */
70 {
71 public:
72
73 unsigned int m_useRandomSamples; //!< If true, random samples will be used instead of regular spaced samples.
74 unsigned int m_numberOfClusters; //!< The number of clusters (classes) to estimate in the image.
75 unsigned int m_maxIterations; //!< The maximum of iterations (E/M steps) to perform if convergence is not achieved.
76 unsigned int m_maxInputPoints; //!< The maximum number of points used to estimate the clusters (default = 1000).
77 double m_epsilon; //!< The stop criteria. When the clusters change in a value smaller then epsilon, the convergence is achieved.
78 std::vector<std::vector<double> > m_clustersMeans; //!< The previously estimated means of the clusters (optional).
79
81
83
84 //overload
85 const Parameters& operator=(const Parameters& params);
86
87 //overload
88 void reset() ;
89
90 //overload
91 AbstractParameters* clone() const;
92
93 //overload
94 bool serialize ( AlgorithmParametersSerializer& serializer ) const;
95 };
96
97 public:
98
100
102
103 //overload
104 bool initialize(ClassifierStrategyParameters const* const strategyParams) ;
105
106 //overload
107 bool execute() ;
108
109 protected:
110
111 bool m_isInitialized; //!< True if this instance is initialized.
112 ClassifierEMStrategy::Parameters m_parameters; //!< Internal execution parameters.
113
114 };
115
116 /*!
117 \class ClassifierEMStrategyFactory
118
119 \brief Raster EM Classifier strategy factory.
120 */
122 {
123 public:
124
126
128
129 //overload
131 };
132
133 } // end namespace rp
134} // end namespace te
135
136#endif // __TERRALIB_RP_INTERNAL_CLASSIFIEREMSTRATEGY_H
Raster classifier strategy factory base class.
Raster classifier strategy base class.
A class to standardize algorithm parameters serialization.
Raster EM Classifier strategy factory.
te::rp::ClassifierStrategy * build()
Concrete factories (derived from this one) must implement this method in order to create objects.
unsigned int m_useRandomSamples
If true, random samples will be used instead of regular spaced samples.
unsigned int m_numberOfClusters
The number of clusters (classes) to estimate in the image.
unsigned int m_maxIterations
The maximum of iterations (E/M steps) to perform if convergence is not achieved.
const Parameters & operator=(const Parameters &params)
double m_epsilon
The stop criteria. When the clusters change in a value smaller then epsilon, the convergence is achie...
AbstractParameters * clone() const
Create a clone copy of this instance.
std::vector< std::vector< double > > m_clustersMeans
The previously estimated means of the clusters (optional).
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state.
bool serialize(AlgorithmParametersSerializer &serializer) const
Returns a parameter serialization object.
unsigned int m_maxInputPoints
The maximum number of points used to estimate the clusters (default = 1000).
EM strategy for pixel-based classification. This is an unsupervised and pixel-based classification al...
bool execute()
Executes the classification strategy.
bool initialize(ClassifierStrategyParameters const *const strategyParams)
Initialize the classification strategy.
bool m_isInitialized
True if this instance is initialized.
ClassifierEMStrategy::Parameters m_parameters
Internal execution parameters.
Raster classifier strategy factory base class.
Raster classifier strategy base class.
TerraLib.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
Proxy configuration file for TerraView (see terraview_config.h).