IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 6, 2008, 2:07:23 PM (18 years ago)
Author:
Paul Price
Message:

Adding parameter 'stride' to control the size of convolution patches (in pmSubtractionConvolve). Previously we have made this the (full) size of the kernel, but there's no reason why it can't be bigger. Making this value larger means the kernel doesn't have to be generated as often.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtraction.c

    r20561 r20568  
    10881088
    10891089bool pmSubtractionConvolve(pmReadout *out1, pmReadout *out2, const pmReadout *ro1, const pmReadout *ro2,
    1090                            psImage *subMask, psMaskType maskBad, psMaskType maskPoor, float poorFrac,
    1091                            float sysError, const psRegion *region, const pmSubtractionKernels *kernels,
    1092                            bool doBG, bool useFFT)
     1090                           psImage *subMask, int stride, psMaskType maskBad, psMaskType maskPoor,
     1091                           float poorFrac, float sysError, const psRegion *region,
     1092                           const pmSubtractionKernels *kernels, bool doBG, bool useFFT)
    10931093{
    10941094    int numCols = 0, numRows = 0;       // Image dimensions
     
    11241124        PS_ASSERT_IMAGE_SIZE(subMask, numCols, numRows, false);
    11251125    }
     1126    PS_ASSERT_INT_NONNEGATIVE(stride, false);
     1127    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(poorFrac, 0.0, false);
     1128    PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(poorFrac, 1.0, false);
     1129    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(sysError, 0.0, false);
     1130    PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(sysError, 1.0, false);
    11261131    if (region && psRegionIsNaN(*region)) {
    11271132        psString string = psRegionToString(*region);
     
    12121217
    12131218    int size = kernels->size;           // Half-size of kernel
    1214     int fullSize = 2 * size + 1;        // Full size of kernel
    12151219
    12161220    // Get region for convolution: [xMin:xMax,yMin:yMax]
     
    12361240    psImageConvolveSetThreads(false);
    12371241
    1238     for (int j = yMin; j < yMax; j += fullSize) {
    1239         int ySubMax = PS_MIN(j + fullSize, yMax); // Range for subregion of interest
    1240         for (int i = xMin; i < xMax; i += fullSize) {
    1241             int xSubMax = PS_MIN(i + fullSize, xMax); // Range for subregion of interest
     1242    if (stride == 0) {
     1243        // Use the full size of the kernel
     1244        stride = 2 * size + 1;
     1245    }
     1246
     1247    for (int j = yMin; j < yMax; j += stride) {
     1248        int ySubMax = PS_MIN(j + stride, yMax); // Range for subregion of interest
     1249        for (int i = xMin; i < xMax; i += stride) {
     1250            int xSubMax = PS_MIN(i + stride, xMax); // Range for subregion of interest
    12421251
    12431252            psRegion *subRegion = psRegionAlloc(i, xSubMax, j, ySubMax); // Bounds of subtraction
Note: See TracChangeset for help on using the changeset viewer.