Skip to content
Snippets Groups Projects
Commit 940ed00f authored by Julien Michel's avatar Julien Michel
Browse files

Merge branch 'patch-meanshift-smoothing' into develop

parents 1de2379d 7d44e775
No related branches found
No related tags found
No related merge requests found
......@@ -375,7 +375,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
neighborhoodRegion.SetSize(regionSize);
RealType weightSum = 0;
RealVector jointNeighbor(ImageDimension + m_NumberOfComponentsPerPixel), shifts(ImageDimension + m_NumberOfComponentsPerPixel);
RealVector shifts(jointDimension);
// An iterator on the neighborhood of the current pixel (in joint
// spatial-range domain)
......@@ -385,7 +385,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
it.GoToBegin();
while (!it.IsAtEnd())
{
jointNeighbor = it.Get();
const RealType *jointNeighbor = it.GetPixelPointer();
// Compute the squared norm of the difference
// This is the L2 norm, TODO: replace by the templated norm
......@@ -393,7 +393,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
for (unsigned int comp = 0; comp < jointDimension; comp++)
{
shifts[comp] = jointNeighbor[comp] - jointPixel[comp];
double d = shifts[comp]/bandwidth[comp];
double d = shifts[comp] / bandwidth[comp];
norm2 += d*d;
}
......@@ -554,7 +554,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
typename OutputImageType::PixelType rangePixel(m_NumberOfComponentsPerPixel);
typename OutputSpatialImageType::PixelType spatialPixel(ImageDimension);
RealVector jointPixel;
RealVector jointPixel(jointDimension);
RealVector bandwidth(jointDimension);
for (unsigned int comp = 0; comp < ImageDimension; comp++)
......@@ -612,7 +612,9 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
// get input pixel in the joint spatial-range domain (with components
// normalized by bandwith)
jointPixel = jointIt.Get(); // Pixel in the joint spatial-range domain
const RealVector &jointPixelVal = jointIt.Get(); // Pixel in the joint spatial-range domain
for (unsigned int comp = 0; comp < jointDimension; comp++)
jointPixel[comp] = jointPixelVal[comp];
for (unsigned int comp = ImageDimension; comp < jointDimension; comp++)
bandwidth[comp] = m_RangeBandwidthRamp*jointPixel[comp]+m_RangeBandwidth;
......
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