30 #include "boost/format.hpp" 38 void printKernel(
Kernel const &kernel,
bool doNormalize,
double xPos,
double yPos, std::string pixelFmt) {
42 double kSum = kernel.
computeImage(kImage, doNormalize, xPos, yPos);
44 for (
int y = kImage.getHeight() - 1; y >= 0; --y) {
47 std::cout << boost::format(pixelFmt) % *ptr <<
" ";
49 std::cout << std::endl;
52 if (doNormalize && std::abs(static_cast<double>(kSum) - 1.0) > 1.0e-5) {
53 std::cout << boost::format(
"Warning! Sum of all pixels = %9.5f != 1.0\n") % kSum;
55 std::cout << std::endl;
_const_view_t::x_iterator const_x_iterator
A const iterator for traversing the pixels in a row.
void printKernel(lsst::afw::math::Kernel const &kernel, bool doNormalize, double x=0, double y=0, std::string pixelFmt="%7.3f")
Print the pixel values of a Kernel to std::cout.
A base class for image defects.
double computeImage(lsst::afw::image::Image< Pixel > &image, bool doNormalize, double x=0.0, double y=0.0) const
Compute an image (pixellized representation of the kernel) in place.
Kernels are used for convolution with MaskedImages and (eventually) Images.
geom::Extent2I const getDimensions() const
Return the Kernel's dimensions (width, height)