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 void convolve(OutImageT& convolvedImage, InImageT
const& inImage, KernelT
const& kernel,
bool doNormalize,
208 bool doCopyEdge =
false);
215 template <
typename ImageT>
219 typedef typename ImageT::SinglePixel SinglePixelT;
236 template <
typename MaskedImageT>
247 auto maskPixel = MaskedImageT::Mask::getPlaneBitMask(
"NO_DATA");
251 return typename MaskedImageT::SinglePixel(imagePixel, maskPixel, variancePixel);
274 template <
typename OutImageT,
typename InImageT>
276 typename InImageT::const_xy_locator inImageLocator,
278 typename OutImageT::SinglePixel outValue = 0;
279 for (
int kRow = 0; kRow != kHeight; ++kRow) {
281 kEnd = kernelLocator + image::detail::difference_type(kWidth, 0);
282 kernelLocator != kEnd; ++inImageLocator.x(), ++kernelLocator.x()) {
285 outValue += *inImageLocator * kVal;
289 inImageLocator += image::detail::difference_type(-kWidth, 1);
290 kernelLocator += image::detail::difference_type(-kWidth, 1);
310 template <
typename OutImageT,
typename InImageT>
311 inline typename OutImageT::SinglePixel
convolveAtAPoint(
typename InImageT::const_xy_locator inImageLocator,
316 typedef typename OutImageT::SinglePixel OutT;
318 for (k_iter kernelYIter = kernelYList.
begin(), yEnd = kernelYList.
end(); kernelYIter != yEnd;
321 for (k_iter kernelXIter = kernelXList.
begin(), xEnd = kernelXList.
end(); kernelXIter != xEnd;
322 ++kernelXIter, ++inImageLocator.x()) {
325 outValueY += *inImageLocator * kValX;
329 double const kValY = *kernelYIter;
331 outValue += outValueY * kValY;
334 inImageLocator += image::detail::difference_type(-kernelXList.
size(), 1);
343 #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