Skip to content
Snippets Groups Projects
Commit 72179b71 authored by Mathieu Deltorre's avatar Mathieu Deltorre
Browse files

*correction bug ComputeDescriptor acces en dehors de l'image

parent ec6c9118
No related branches found
No related tags found
No related merge requests found
......@@ -707,27 +707,31 @@ namespace otb
nIndex[0] = static_cast<unsigned int>(vcl_floor(currentScale.GetIndex()[0]+nx+0.5));
nIndex[1] = static_cast<unsigned int>(vcl_floor(currentScale.GetIndex()[1]+ny+0.5));
lIterNMagnitude.SetIndex(nIndex);
lIterNOrientation.SetIndex(nIndex);
PixelType lMagnitude = lIterNMagnitude.Get();
PixelType lOrientation = lIterNOrientation.Get();
unsigned int lHistoIndex = 0;
double diffAngle = lOrientation/(2*M_PI)*8 - orientation/45;
if (diffAngle>=0)
{
lHistoIndex = static_cast<unsigned int>(diffAngle);
}
else
// test : if oriented index is in image
if (lIterNMagnitude.GetRegion().IsInside(nIndex))
{
lHistoIndex = static_cast<unsigned int>(diffAngle+8);
}
double lWeightMagnitude = vcl_exp(dist2/(2*lSigma*lSigma));
PixelType lHistoEntry = lMagnitude*lWeightMagnitude;
lIterNMagnitude.SetIndex(nIndex);
lIterNOrientation.SetIndex(nIndex);
PixelType lMagnitude = lIterNMagnitude.Get();
PixelType lOrientation = lIterNOrientation.Get();
unsigned int lHistoIndex = 0;
double diffAngle = lOrientation/(2*M_PI)*8 - orientation/45;
if (diffAngle>=0)
{
lHistoIndex = static_cast<unsigned int>(diffAngle);
}
else
{
lHistoIndex = static_cast<unsigned int>(diffAngle+8);
}
double lWeightMagnitude = vcl_exp(dist2/(2*lSigma*lSigma));
PixelType lHistoEntry = lMagnitude*lWeightMagnitude;
lHistogram[lHDescriptors*4*8+lVDescriptors*8+lHistoIndex] += lHistoEntry;
lHistogram[lHDescriptors*4*8+lVDescriptors*8+lHistoIndex] += lHistoEntry;
}
}
}
}
......
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