Skip to content
Snippets Groups Projects
Commit 7fc6050a authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

ENH: fixing bugs otbCountImageFilter

parent 599c3654
No related branches found
No related tags found
No related merge requests found
......@@ -71,8 +71,6 @@ CountImageFilter<TInputImage, TDetector, TCount, TOutputImage >
itk::ImageRegionIterator<OutputImageType>
itOutput(outputImage, outputImage->GetLargestPossibleRegion());
CountMethodType CountMethod;
itInput.GoToBegin();
itOutput.GoToBegin();
......
......@@ -43,13 +43,11 @@ namespace otb
SiftFastImageFilter<TInputImage,TOutputPointSet>
::GenerateData()
{
// Get the input image pointer
const InputImageType * inputPtr = this->GetInput();
OutputPointSetPointerType outputPointSet = this->GetOutput();
typename InputImageType::SizeType size = inputPtr->GetLargestPossibleRegion().GetSize();
// Rescale data in the [0,1] range
......
......@@ -48,23 +48,27 @@ public:
int accu = 0;
double surface = M_PI*size*size;
typedef typename TPointSet::PointsContainer::ConstIterator iteratorType;
iteratorType it = pointSet->GetPoints()->Begin();
while( it != pointSet->GetPoints()->End())
if(pointSet->GetNumberOfPoints() != 0)
{
float distX2 =( index[0]-it.Value()[0])*( index[0]-it.Value()[0]);
float distY2 =( index[1]-it.Value()[1])*( index[1]-it.Value()[1]);
float dist = vcl_sqrt(distX2 + distY2);
typedef typename TPointSet::PointsContainer::ConstIterator iteratorType;
iteratorType it = pointSet->GetPoints()->Begin();
if(dist <= size)
accu++;
while( it != pointSet->GetPoints()->End())
{
float distX2 =( index[0]-it.Value()[0])*( index[0]-it.Value()[0]);
float distY2 =( index[1]-it.Value()[1])*( index[1]-it.Value()[1]);
float dist = vcl_sqrt(distX2 + distY2);
if(dist <= size)
accu++;
++it;
++it;
}
}
else
return 0.;
return static_cast<float>(accu/surface);
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment