Determine the Kron Aperture from an image.
Determines the object Kron aperture, using the shape from source.getShape() (e.g. SDSS's adaptive moments)
243 double const sigma = ctrl.smoothingSigma;
244 bool const smoothImage = sigma > 0;
245 int kSize = smoothImage ? 2*
int(2*sigma) + 1 : 1;
246 afw::math::GaussianFunction1<afw::math::Kernel::Pixel> gaussFunc(smoothImage ? sigma : 100);
247 afw::math::SeparableKernel
kernel(kSize, kSize, gaussFunc, gaussFunc);
248 bool const doNormalize =
true, doCopyEdge =
false;
249 afw::math::ConvolutionControl convCtrl(doNormalize, doCopyEdge);
250 double radius0 = axes.getDeterminantRadius();
253 for (
int i = 0; i < ctrl.nIterForRadius; ++i) {
254 axes.scale(ctrl.nSigmaForRadius);
255 radiusForRadius = axes.getDeterminantRadius();
260 afw::geom::ellipses::Ellipse(axes, center)));
261 afw::geom::Box2I
bbox = !smoothImage ?
263 kernel.growBBox(foot.getBBox());
264 bbox.clip(
image.getBBox());
272 FootprintFindMoment<ImageT, afw::detection::Psf::Image> iRFunctor(
273 subImage, center, axes.getA()/axes.getB(), axes.getTheta()
277 foot.getSpans()->applyFunctor(
278 iRFunctor, *(subImage.getImage()));
286 if (!iRFunctor.getGood()) {
287 throw LSST_EXCEPT(BadKronException,
"Bad integral defining Kron radius");
290 radius = iRFunctor.getIr()*
sqrt(axes.getB()/axes.getA());
291 if (radius <= radius0) {
296 axes.scale(radius/axes.getDeterminantRadius());
300 return std::make_shared<KronAperture>(center, axes, radiusForRadius);
static std::shared_ptr< geom::SpanSet > fromShape(int r, Stencil s=Stencil::CIRCLE, lsst::geom::Point2I offset=lsst::geom::Point2I())
Factory function for creating SpanSets from a Stencil.
afw::table::Key< double > sigma
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...
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Reports attempts to access elements outside a valid range of indices.
lsst::afw::detection::Footprint Footprint
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
#define LSST_EXCEPT_ADD(e, m)
Add the current location and a message to an existing exception before rethrowing it...