Changeset 13365 for trunk/psModules/src/imcombine/pmSubtractionStamps.c
- Timestamp:
- May 11, 2007, 3:58:53 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmSubtractionStamps.c
r13364 r13365 42 42 psArray *pmSubtractionFindStamps(psArray *stamps, const psImage *image, const psImage *mask, 43 43 psMaskType maskVal, psMaskType used, float threshold, 44 float spacing, int footprint)44 float spacing, int border) 45 45 { 46 46 PS_ASSERT_IMAGE_NON_NULL(image, NULL); … … 56 56 } 57 57 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); 61 61 62 int xNumStamps = image->numCols / spacing + 1; // Number of stamps in x dimension63 int yNumStamps = image->numRows / spacing + 1; // Number of stamps in y dimension62 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 64 64 65 65 if (stamps) { … … 95 95 96 96 // 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); 102 103 103 104 for (int y = yMin; y <= yMax ; y++) { … … 107 108 if (mask) { 108 109 // 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) { 110 111 ok = false; 111 112 } 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) { 115 116 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 116 121 } 117 122 }
Note:
See TracChangeset
for help on using the changeset viewer.
