IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 1, 2009, 4:10:12 PM (17 years ago)
Author:
eugene
Message:

add utility function to calculate covarFactor in an aperture

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageCovariance.c

    r24832 r25994  
    212212}
    213213
     214float psImageCovarianceFactorForAperture(const psKernel *covar, float radius)
     215{
     216    if (!covar) return 1.0;
     217
     218    float Sum = 0.0;
     219
     220    for (int y = covar->yMin; y <= covar->yMax; y++) {
     221        if (y < -radius) continue;
     222        if (y > +radius) continue;
     223        for (int x = covar->xMin; x <= covar->xMax; x++) {
     224            if (x < -radius) continue;
     225            if (x > +radius) continue;
     226
     227            if (hypot(x, y) > radius) continue;
     228
     229            psAssert (isfinite(covar->kernel[y][x]), "invalid NAN in covariance matrix");
     230            Sum += covar->kernel[y][x];
     231        }
     232    }
     233
     234    return Sum;
     235}
     236
    214237psKernel *psImageCovarianceSum(const psArray *array)
    215238{
Note: See TracChangeset for help on using the changeset viewer.