#include <fpa/Image/Functors/RegionGrowAllBelongsFunction.h>
#include <fpa/VTK/Image2DObserver.h>
#include <cpPlugins/Extensions/Algorithms/IterativeGaussianModelEstimator.h>
+#include <cpPlugins/Extensions/Algorithms/RGBToYPbPrFunction.h>
// -------------------------------------------------------------------------
const unsigned int Dim = 2;
typedef typename Superclass::TIndex TIndex;
typedef cpPlugins::Extensions::Algorithms::IterativeGaussianModelEstimator< S, 3 > TEstimator;
+ typedef cpPlugins::Extensions::Algorithms::RGBToYPbPrFunction< S > TYPbPrFunction;
public:
itkNewMacro( Self );
{
if( !( this->m_Marks->GetPixel( idx ) ) )
{
- this->m_Estimator->AddSample(
- S( rgb.GetRed( ) ),
- S( rgb.GetGreen( ) ),
- S( rgb.GetBlue( ) )
- );
+ this->m_Estimator->AddSample( this->m_YPbPrFunction( rgb ) );
this->m_Marks->SetPixel( idx, true );
-#error CONTINUE HERE!!!!
- std::cout << this->m_Estimator->GetNumberOfSamples( ) << " " << this->m_ModelSupport << std::endl;
if( this->m_Estimator->GetNumberOfSamples( ) == this->m_ModelSupport )
+ {
this->m_Estimating = true;
+ this->m_Estimator->UpdateModel( );
+ std::cout << this->m_Estimator->GetMinimumProbability( ) << std::endl;
+ std::cout << this->m_Estimator->GetMaximumProbability( ) << std::endl;
+
+ } // fi
} // fi
return( true );
}
else
- return( false );
+ {
+ S p = this->m_Estimator->Probability( this->m_YPbPrFunction( rgb ) );
+ return( p > this->m_Estimator->GetMinimumProbability( ) );
+
+ } // fi
}
protected:
protected:
typename TEstimator::Pointer m_Estimator;
+ TYPbPrFunction m_YPbPrFunction;
+
unsigned long m_ModelSupport;
mutable bool m_Estimating;
typename TMarks::Pointer m_Marks;