Commit cb1de131 authored by Julien Michel's avatar Julien Michel
Browse files

ENH: Modifying slightly the samples localizations generation policy (more...

ENH: Modifying slightly the samples localizations generation policy (more positive points are samples around input positive points)
parent 33b871a0
......@@ -100,6 +100,10 @@ public:
itkGetConstMacro(NbMaxIteration, unsigned long int);
itkSetMacro(NbMaxIteration, unsigned long int);
/** Set the number of samples position to generate inside the inhibition radius window around a positive point */
itkGetConstMacro(NumberOfPositiveSamplesPerPoint, unsigned int);
itkSetMacro(NumberOfPositiveSamplesPerPoint,unsigned int);
/** Set the seed for random number generator */
void SetSeed(unsigned int seed)
{
......@@ -127,6 +131,7 @@ private:
double m_RandomLocalizationDensity;
double m_InhibitionRadius;
unsigned long int m_NbMaxIteration;
unsigned int m_NumberOfPositiveSamplesPerPoint;
};
} // end namespace otb
......
......@@ -31,7 +31,8 @@ LabeledSampleLocalizationGenerator<TVectorData>
m_NoClassIdentifier(0),
m_RandomLocalizationDensity(.005),
m_InhibitionRadius(5.0),
m_NbMaxIteration(10000)
m_NbMaxIteration(10000),
m_NumberOfPositiveSamplesPerPoint(10)
{
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredOutputs(1);
......@@ -161,7 +162,6 @@ LabeledSampleLocalizationGenerator<TVectorData>
if(valid)
{
vPoint.push_back(point);
// insiders.push_back(point);
}
else
{
......@@ -172,6 +172,21 @@ LabeledSampleLocalizationGenerator<TVectorData>
nbIter --;
}
// Densifying positive points
for(typename PointVectorType::const_iterator iIt = insiders.begin(); iIt != insiders.end();++iIt)
{
for(unsigned int i = 0; i < m_NumberOfPositiveSamplesPerPoint; ++i)
{
PointType point;
for(unsigned int dim = 0; dim < 2; ++dim)
{
point[dim] = (*iIt)[dim]+this->m_RandomGenerator->GetUniformVariate(-m_InhibitionRadius,m_InhibitionRadius);
}
pPoint.push_back(point);
}
}
std::pair<PointVectorType,PointVectorType> result;
result.first = (vPoint);
result.second = (pPoint);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment