cmeans.hh File Reference
Include dependency graph for cmeans.hh:

Go to the source code of this file.

Data Structures

class  CMeans
 
class  CMeansInitializerSizedPlugin
 
class  CMeans::Initializer
 
class  CMeans::SparseProbmap
 

Typedefs

typedef TFactory< CMeans::InitializerCMeansInitializerPlugin
 
typedef THandlerSingleton< TFactoryPluginHandler< CMeansInitializerPlugin > > CMeansInitializerPluginHandler
 

Functions

template<typename T , template< class > class Field>
void cmeans_evaluate_probabilities (const Field< T > &image, const Field< float > &gain, const std::vector< double > &class_centers, std::vector< Field< float >> &pv)
 evaluate the probabilities for a c-means classification with gain field More...
 
template<typename T , template< class > class Field>
double cmeans_update_class_centers (const Field< T > &image, const Field< float > &gain, const std::vector< Field< float >> &pv, std::vector< double > &class_centers)
 

Variables

class EXPORT_CORE CMeans private
 

Typedef Documentation

◆ CMeansInitializerPlugin

Definition at line 259 of file cmeans.hh.

◆ CMeansInitializerPluginHandler

Function Documentation

◆ cmeans_evaluate_probabilities()

template<typename T , template< class > class Field>
void cmeans_evaluate_probabilities ( const Field< T > &  image,
const Field< float > &  gain,
const std::vector< double > &  class_centers,
std::vector< Field< float >> &  pv 
)

evaluate the probabilities for a c-means classification with gain field

This function evaluates the per-pixel class probabilities for a c-means classification with gain field correction.

With n classes the evalaution is done aoocrding to

\[ p_{k,i} := \left\{\begin{array}{lcl} I_k < c_0 & & p_{k,0} = 1, p_{k,i} = 0 \: \forall \: i \in [1, n-1]\\ c_j < I_k < c_{j+1} & & p_{k,l} = \frac{(I_k - g_k * c_{m})^2}{(I_k - g_k * c_{m})^2 + (I_k - g_k * c_{l})^2} \: \forall \: (l,m) \in \{(j, j+1), (j+1, j)\}\\ I_k > c_{n-1} & & p_{k,n} = 1, p_{k,i} = 0 \: \forall \: i \in [0, n-2] \end{array} \right. \]

Template Parameters
Tinput pixel type of the data to be classified
Fieldtemplate of the data field type
Parameters
[in]imageimage the classification is applied to
[in]gainmultiplicative gain field
[in]class_centers
[out]pvprobability fields containing the evaluated probabilities

Definition at line 134 of file cmeans.hh.

◆ cmeans_update_class_centers()

template<typename T , template< class > class Field>
double cmeans_update_class_centers ( const Field< T > &  image,
const Field< float > &  gain,
const std::vector< Field< float >> &  pv,
std::vector< double > &  class_centers 
)

Evaluate the new clas centers from

\[ \sum_{k,i} (p_{i,k} I_k - g_k c_i)^2 \rightarrow \min \]

In order to avoid a ping-pong effect, the actual class center update is evaluated according to

\[ c_i^{(t+1)} = \frac{1}{2} \left( \sum_{k} \frac{p_{i,k}^2 g_k I_k}{ p_{i,k}^2 g_k^2 } - c_i^{(t)} \right) \]

Template Parameters
Tinput pixel type of the data to be classified
Fieldtemplate of the data field type
Parameters
[in]imageimage the classification is applied to
[in]gainmultiplicative gain field
[in]pvprobability fields
[in,out]class_centers
Returns
sum of absolute change applied to the class centers

Definition at line 215 of file cmeans.hh.

References cvwarn().

Variable Documentation

◆ private

class EXPORT_CORE CMeans private