The application Superimpose crashed with a segmentation fault during
resampling. Investigation revealed that the interpolated index was out
of image bounds. The application uses the PHR mode and resamples the XS
image with a otb::GridResampleImageFilter
. This filter doesn't check
explicitly that input indexes are in the input buffered region. It
uses a m_ReachableOutputRegion
to crop the output region
processed. The problem appears because an output pixel is right on the
border of the input image extent, and when someone uses a nearest neighbor
interpolator, this one converts the continuous index to an
out-of-bound index.
The solution was to introduce an epsilon margin to compute the
m_ReachableOutputRegion
.
Closes #2046 (closed)
otbGridResampleImageFilter: Add new attribute m_InterpolationMargin
with corresponding get/set. Set it's default value to 0.0. Use it in processing.
Superimpose: Set the margin to 1e-9 when using nearest neighbor interpolation.
Added a new test for the Superimpose application with PHR images and nearest neighbor interpolation.
The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.
Check before merging:
git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i
on latest changes and commit