1 #ifndef __FPA__IMAGE__FUNCTORS__GAUSSIANMODELESTIMATORFUNCTION__HXX__
2 #define __FPA__IMAGE__FUNCTORS__GAUSSIANMODELESTIMATORFUNCTION__HXX__
4 // -------------------------------------------------------------------------
5 template< class I, class S >
6 bool fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >::
7 SaveModelToFile( const std::string& filename ) const
9 this->m_Estimator->SaveModelToFile( filename );
12 // -------------------------------------------------------------------------
13 template< class I, class S >
14 bool fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >::
15 LoadModelFromFile( const std::string& filename )
17 this->m_Estimator->LoadModelFromFile( filename );
18 this->m_RealModelSupport =
19 this->m_ModelSupport + this->m_Estimator->GetNumberOfSamples( );
20 this->m_Estimating = false;
24 // -------------------------------------------------------------------------
25 template< class I, class S >
26 void fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >::
27 SetModelSupport( const unsigned long& s )
29 this->m_ModelSupport = s;
30 this->m_RealModelSupport = s;
34 // -------------------------------------------------------------------------
35 template< class I, class S >
36 bool fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >::
37 Evaluate( const typename I::PixelType& rgb ) const
39 if( !this->m_Estimating && this->m_ModelSupport > 0 )
41 this->m_Estimator->AddSample( this->m_YPbPrFunction( rgb ) );
42 if( this->m_Estimator->GetNumberOfSamples( ) == this->m_RealModelSupport )
43 this->m_Estimating = true;
48 S p = this->m_Estimator->Probability( this->m_YPbPrFunction( rgb ) );
54 // -------------------------------------------------------------------------
55 template< class I, class S >
56 fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >::
57 GaussianModelEstimatorFunction( )
60 m_RealModelSupport( 10 )
62 this->m_Estimator = TEstimator::New( );
63 this->m_Estimator->Clear( );
64 this->m_Estimating = false;
67 // -------------------------------------------------------------------------
68 template< class I, class S >
69 fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >::
70 ~GaussianModelEstimatorFunction( )
74 #endif // __FPA__IMAGE__FUNCTORS__GAUSSIANMODELESTIMATORFUNCTION__HXX__