25 #ifndef LSST_AFW_MATH_CONVOLVEIMAGE_H
26 #define LSST_AFW_MATH_CONVOLVEIMAGE_H
53 bool doCopyEdge =
false,
54 int maxInterpolationDistance = 10
58 : _doNormalize(doNormalize),
59 _doCopyEdge(doCopyEdge),
60 _maxInterpolationDistance(maxInterpolationDistance) {}
69 _maxInterpolationDistance = maxInterpolationDistance;
75 int _maxInterpolationDistance;
102 template <
typename OutImageT,
typename InImageT>
103 void scaledPlus(OutImageT& outImage,
double c1, InImageT
const& inImage1,
double c2,
104 InImageT
const& inImage2);
106 template <
typename OutImageT,
typename InImageT>
108 typename InImageT::const_xy_locator inImageLocator,
110 int kWidth,
int kHeight);
112 template <
typename OutImageT,
typename InImageT>
114 typename InImageT::const_xy_locator inImageLocator,
190 template <
typename OutImageT,
typename InImageT,
typename KernelT>
191 void convolve(OutImageT& convolvedImage, InImageT
const& inImage, KernelT
const& kernel,
192 ConvolutionControl
const& convolutionControl = ConvolutionControl());
206 template <
typename OutImageT,
typename InImageT,
typename KernelT>
207 [[deprecated(
"Use `convolve` with a `ConvolutionControl` instead. To be removed after 20.0.0.")]]
209 convolve(OutImageT& convolvedImage, InImageT
const& inImage, KernelT
const& kernel,
bool doNormalize,
210 bool doCopyEdge =
false);
217 template <
typename ImageT>
221 typedef typename ImageT::SinglePixel SinglePixelT;
238 template <
typename MaskedImageT>
249 auto maskPixel = MaskedImageT::Mask::getPlaneBitMask(
"NO_DATA");
253 return typename MaskedImageT::SinglePixel(imagePixel, maskPixel, variancePixel);
276 template <
typename OutImageT,
typename InImageT>
278 typename InImageT::const_xy_locator inImageLocator,
280 typename OutImageT::SinglePixel outValue = 0;
281 for (
int kRow = 0; kRow != kHeight; ++kRow) {
283 kEnd = kernelLocator + image::detail::difference_type(kWidth, 0);
284 kernelLocator != kEnd; ++inImageLocator.x(), ++kernelLocator.x()) {
287 outValue += *inImageLocator * kVal;
291 inImageLocator += image::detail::difference_type(-kWidth, 1);
292 kernelLocator += image::detail::difference_type(-kWidth, 1);
312 template <
typename OutImageT,
typename InImageT>
313 inline typename OutImageT::SinglePixel
convolveAtAPoint(
typename InImageT::const_xy_locator inImageLocator,
318 typedef typename OutImageT::SinglePixel OutT;
320 for (k_iter kernelYIter = kernelYList.
begin(), yEnd = kernelYList.
end(); kernelYIter != yEnd;
323 for (k_iter kernelXIter = kernelXList.
begin(), xEnd = kernelXList.
end(); kernelXIter != xEnd;
324 ++kernelXIter, ++inImageLocator.x()) {
327 outValueY += *inImageLocator * kValX;
331 double const kValY = *kernelYIter;
333 outValue += outValueY * kValY;
336 inImageLocator += image::detail::difference_type(-kernelXList.
size(), 1);
345 #endif // !defined(LSST_AFW_MATH_CONVOLVEIMAGE_H)