25 #ifndef LSST_AFW_MATH_CONVOLVEIMAGE_H
26 #define LSST_AFW_MATH_CONVOLVEIMAGE_H
60 bool doNormalize =
true,
61 bool doCopyEdge =
false,
62 int maxInterpolationDistance = 10
89 template <
typename OutImageT,
typename InImageT>
93 InImageT
const &inImage1,
95 InImageT
const &inImage2);
97 template <
typename OutImageT,
typename InImageT>
99 typename InImageT::const_xy_locator inImageLocator,
104 template <
typename OutImageT,
typename InImageT>
106 typename InImageT::const_xy_locator inImageLocator,
107 std::vector<lsst::afw::math::Kernel::Pixel>
const& kernelColList,
108 std::vector<lsst::afw::math::Kernel::Pixel>
const& kernelRowList);
110 template <
typename OutImageT,
typename InImageT,
typename KernelT>
112 OutImageT& convolvedImage,
113 InImageT
const& inImage,
114 KernelT
const& kernel,
117 template <
typename OutImageT,
typename InImageT,
typename KernelT>
119 OutImageT& convolvedImage,
120 InImageT
const& inImage,
121 KernelT
const& kernel,
123 bool doCopyEdge =
false);
130 template <
typename ImageT>
135 typedef typename ImageT::SinglePixel SinglePixelT;
137 std::numeric_limits<SinglePixelT>::has_quiet_NaN ?
138 std::numeric_limits<SinglePixelT>::quiet_NaN() : 0);
149 template <
typename MaskedImageT>
154 typedef typename MaskedImageT::Image::Pixel ImagePixelT;
155 typedef typename MaskedImageT::Variance::Pixel VariancePixelT;
157 return typename MaskedImageT::SinglePixel(
158 std::numeric_limits<ImagePixelT>::has_quiet_NaN ?
159 std::numeric_limits<ImagePixelT>::quiet_NaN() : 0,
160 MaskedImageT::Mask::getPlaneBitMask(
"NO_DATA"),
161 std::numeric_limits<VariancePixelT>::infinity());
178 template <
typename OutImageT,
typename InImageT>
180 typename InImageT::const_xy_locator inImageLocator,
187 typename OutImageT::SinglePixel outValue = 0;
188 for (
int kRow = 0; kRow != kHeight; ++kRow) {
190 kernelLocator + lsst::afw::image::detail::difference_type(kWidth, 0);
191 kernelLocator != kEnd; ++inImageLocator.x(), ++kernelLocator.x()) {
194 outValue += *inImageLocator*kVal;
198 inImageLocator += lsst::afw::image::detail::difference_type(-kWidth, 1);
199 kernelLocator += lsst::afw::image::detail::difference_type(-kWidth, 1);
214 template <
typename OutImageT,
typename InImageT>
216 typename InImageT::const_xy_locator inImageLocator,
217 std::vector<lsst::afw::math::Kernel::Pixel>
const &kernelXList,
219 std::vector<lsst::afw::math::Kernel::Pixel>
const &kernelYList)
221 typedef typename std::vector<lsst::afw::math::Kernel::Pixel>::const_iterator k_iter;
223 typedef typename OutImageT::SinglePixel OutT;
225 for (k_iter kernelYIter = kernelYList.begin(), yEnd = kernelYList.end();
226 kernelYIter != yEnd; ++kernelYIter) {
229 for (k_iter kernelXIter = kernelXList.begin(), xEnd = kernelXList.end();
230 kernelXIter != xEnd; ++kernelXIter, ++inImageLocator.x()) {
233 outValueY += *inImageLocator*kValX;
237 double const kValY = *kernelYIter;
239 outValue += outValueY*kValY;
242 inImageLocator += lsst::afw::image::detail::difference_type(-kernelXList.size(), 1);
249 #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.
An include file to include the header files for lsst::afw::geom.
Declare the Kernel class and subclasses.
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.
Include files required for standard LSST Exception handling.
Parameters to control convolution.
bool _doNormalize
normalize the kernel to sum=1?
void setDoCopyEdge(bool doCopyEdge)
bool _doCopyEdge
copy edge pixels from source image
void setDoNormalize(bool doNormalize)
ConvolutionControl(bool doNormalize=true, bool doCopyEdge=false, int maxInterpolationDistance=10)
A traits class for MaskedImage.
bool getDoNormalize() const
void setMaxInterpolationDistance(int maxInterpolationDistance)
ImageT::SinglePixel edgePixel(lsst::afw::image::detail::Image_tag)
Return an off-the-edge pixel appropriate for a given Image type.
_view_t::xy_locator::const_t const_xy_locator
A const_xy_locator.
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...
Implementation of the Class MaskedImage.
bool getDoCopyEdge() const
int _maxInterpolationDistance
maximum width or height of a region
int getMaxInterpolationDistance() const