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,
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) void scaledPlus(OutImageT &outImage, double c1, InImageT const &inImage1, double c2, InImageT const &inImage2)
Compute the scaled sum of two images.
float Pixel
Typedefs to be used for pixel values.
Parameters to control convolution.
void setDoCopyEdge(bool doCopyEdge)
void setDoNormalize(bool doNormalize)
OutImageT::SinglePixel convolveAtAPoint(typename InImageT::const_xy_locator inImageLocator, typename lsst::afw::image::Image< lsst::afw::math::Kernel::Pixel >::const_xy_locator kernelLocator, int kWidth, int kHeight)
Apply convolution kernel to an image at one point.
A base class for image defects.
ConvolutionControl(bool doNormalize=true, bool doCopyEdge=false, int maxInterpolationDistance=10)
A traits class for MaskedImage.
int getMaxInterpolationDistance() const
void setMaxInterpolationDistance(int maxInterpolationDistance)
bool getDoCopyEdge() const
ImageT::SinglePixel edgePixel(lsst::afw::image::detail::Image_tag)
Return an off-the-edge pixel appropriate for a given Image type.
void convolve(OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, ConvolutionControl const &convolutionControl=ConvolutionControl())
Convolve an Image or MaskedImage with a Kernel, setting pixels of an existing output image...
_view_t::xy_locator::const_t const_xy_locator
A const_xy_locator.
bool getDoNormalize() const