IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 11, 2007, 3:58:53 PM (19 years ago)
Author:
Paul Price
Message:

Need to be more careful about the border when searching for stamps. It's not just the footprint, since the kernel size is added on top of the footprint.

File:
1 edited

Legend:

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

    r13364 r13365  
    4242psArray *pmSubtractionFindStamps(psArray *stamps, const psImage *image, const psImage *mask,
    4343                                 psMaskType maskVal, psMaskType used, float threshold,
    44                                  float spacing, int footprint)
     44                                 float spacing, int border)
    4545{
    4646    PS_ASSERT_IMAGE_NON_NULL(image, NULL);
     
    5656    }
    5757    PS_ASSERT_FLOAT_LARGER_THAN(spacing, 0.0, NULL);
    58     PS_ASSERT_INT_NONNEGATIVE(footprint, NULL);
    59     PS_ASSERT_INT_LARGER_THAN(image->numCols, (2 * footprint), NULL);
    60     PS_ASSERT_INT_LARGER_THAN(image->numRows, (2 * footprint), NULL);
     58    PS_ASSERT_INT_NONNEGATIVE(border, NULL);
     59    PS_ASSERT_INT_LARGER_THAN(image->numCols, 2 * border, NULL);
     60    PS_ASSERT_INT_LARGER_THAN(image->numRows, 2 * border, NULL);
    6161
    62     int xNumStamps = image->numCols / spacing + 1; // Number of stamps in x dimension
    63     int yNumStamps = image->numRows / spacing + 1; // Number of stamps in y dimension
     62    int xNumStamps = (image->numCols - 2 * border) / spacing + 1; // Number of stamps in x
     63    int yNumStamps = (image->numRows - 2 * border) / spacing + 1; // Number of stamps in y
    6464
    6565    if (stamps) {
     
    9595
    9696                // Bounds of region to search for stamp
    97                 int yMin = footprint + j * (numRows - 2.0 * footprint) / yNumStamps;
    98                 int yMax = footprint + (j + 1) * (numRows - 2.0 * footprint) / yNumStamps - 1;
    99                 int xMin = footprint + i * (numCols - 2.0 * footprint) / xNumStamps;
    100                 int xMax = footprint + (i + 1) * (numCols - 2.0 * footprint) / xNumStamps - 1;
    101                 assert(yMax < image->numRows && xMax < image->numCols && yMin >= 0 && xMin >= 0);
     97                int yMin = border + j * (numRows - border) / (yNumStamps + 1);
     98                int yMax = border + (j + 1) * (numRows - border) / (yNumStamps + 1) - 1;
     99                int xMin = border + i * (numCols - border) / (xNumStamps + 1);
     100                int xMax = border + (i + 1) * (numCols - border) / (xNumStamps + 1) - 1;
     101                assert(yMax < image->numRows - border && xMax < image->numCols - border &&
     102                       yMin >= border && xMin >= border);
    102103
    103104                for (int y = yMin; y <= yMax ; y++) {
     
    107108                            if (mask) {
    108109                                // Check kernel footprint for bad pixels
    109                                 if (mask->data.U8[y][x] & maskVal) {
     110                                if (mask->data.PS_TYPE_MASK_DATA[y][x] & maskVal) {
    110111                                    ok = false;
    111112                                } else {
    112                                     for (int v = -footprint; v <= footprint && ok; v++) {
    113                                         for (int u = -footprint; u <= footprint && ok; u++) {
    114                                             if (mask->data.U8[y][x] & maskVal) {
     113                                    for (int v = -border; v <= border && ok; v++) {
     114                                        for (int u = -border; u <= border && ok; u++) {
     115                                            if (mask->data.PS_TYPE_MASK_DATA[y + v][x + u] & maskVal) {
    115116                                                ok = false;
     117#if 0
     118                                                // Mark it so we don't have to look so hard next time
     119                                                mask->data.PS_TYPE_MASK_DATA[y][x] |= maskVal;
     120#endif
    116121                                            }
    117122                                        }
Note: See TracChangeset for help on using the changeset viewer.