X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FFunctors%2FGaussianModelEstimatorFunction.hxx;fp=lib%2Ffpa%2FImage%2FFunctors%2FGaussianModelEstimatorFunction.hxx;h=0000000000000000000000000000000000000000;hb=9c4035dc18f4e44a92cda3e3c1c6e583c94ef06b;hp=accfb27825bf66fb6a34918c325499aa149ceb24;hpb=e832f438861464a8d521464b61be7e31c896adb8;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/Functors/GaussianModelEstimatorFunction.hxx b/lib/fpa/Image/Functors/GaussianModelEstimatorFunction.hxx deleted file mode 100644 index accfb27..0000000 --- a/lib/fpa/Image/Functors/GaussianModelEstimatorFunction.hxx +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __FPA__IMAGE__FUNCTORS__GAUSSIANMODELESTIMATORFUNCTION__HXX__ -#define __FPA__IMAGE__FUNCTORS__GAUSSIANMODELESTIMATORFUNCTION__HXX__ - -// ------------------------------------------------------------------------- -template< class I, class S > -bool fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >:: -SaveModelToFile( const std::string& filename ) const -{ - this->m_Estimator->SaveModelToFile( filename ); -} - -// ------------------------------------------------------------------------- -template< class I, class S > -bool fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >:: -LoadModelFromFile( const std::string& filename ) -{ - this->m_Estimator->LoadModelFromFile( filename ); - this->m_RealModelSupport = - this->m_ModelSupport + this->m_Estimator->GetNumberOfSamples( ); - this->m_Estimating = false; - this->Modified( ); -} - -// ------------------------------------------------------------------------- -template< class I, class S > -void fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >:: -SetModelSupport( const unsigned long& s ) -{ - this->m_ModelSupport = s; - this->m_RealModelSupport = s; - this->Modified( ); -} - -// ------------------------------------------------------------------------- -template< class I, class S > -bool fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >:: -Evaluate( const typename I::PixelType& rgb ) const -{ - if( !this->m_Estimating && this->m_ModelSupport > 0 ) - { - this->m_Estimator->AddSample( this->m_YPbPrFunction( rgb ) ); - if( this->m_Estimator->GetNumberOfSamples( ) == this->m_RealModelSupport ) - this->m_Estimating = true; - return( true ); - } - else - { - S p = this->m_Estimator->Probability( this->m_YPbPrFunction( rgb ) ); - return( p >= 0.3 ); - - } // fi -} - -// ------------------------------------------------------------------------- -template< class I, class S > -fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >:: -GaussianModelEstimatorFunction( ) - : Superclass( ), - m_ModelSupport( 10 ), - m_RealModelSupport( 10 ) -{ - this->m_Estimator = TEstimator::New( ); - this->m_Estimator->Clear( ); - this->m_Estimating = false; -} - -// ------------------------------------------------------------------------- -template< class I, class S > -fpa::Image::Functors::GaussianModelEstimatorFunction< I, S >:: -~GaussianModelEstimatorFunction( ) -{ -} - -#endif // __FPA__IMAGE__FUNCTORS__GAUSSIANMODELESTIMATORFUNCTION__HXX__ - -// eof - $RCSfile$