diff --git a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx index f25daa21d9856265f70b9b7ce057069d780f254b..55d75bbd649d416a34089b44b1c529d4866f8444 100644 --- a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx +++ b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx @@ -375,9 +375,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt neighborhoodRegion.SetSize(regionSize); RealType weightSum = 0; - RealVector oneOverBandwidth(jointDimension), shifts(jointDimension); - for (unsigned int comp = 0; comp < jointDimension; comp++) - oneOverBandwidth[comp] = 1.0/bandwidth[comp]; + RealVector shifts(jointDimension); // An iterator on the neighborhood of the current pixel (in joint // spatial-range domain) @@ -395,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] * oneOverBandwidth[comp]; + double d = shifts[comp] / bandwidth[comp]; norm2 += d*d; }