Changeset 5717 for trunk/pois/src/poisStamp.c
- Timestamp:
- Dec 6, 2005, 6:43:52 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/pois/src/poisStamp.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pois/src/poisStamp.c
r3836 r5717 11 11 stamp->matrix = NULL; 12 12 stamp->vector = NULL; 13 psMemSetDeallocator(stamp, (psFreeF cn)poisStampFree);13 psMemSetDeallocator(stamp, (psFreeFunc)poisStampFree); 14 14 15 15 return stamp; … … 18 18 void poisStampFree(poisStamp *stamp) 19 19 { 20 psFree(stamp->matrix); 21 psFree(stamp->vector); 20 if (stamp->matrix) { 21 psFree(stamp->matrix); 22 } 23 if (stamp->vector) { 24 psFree(stamp->vector); 25 } 26 psFree(stamp); 22 27 } 28 29 30 // Return true if the stamp is OK 31 bool poisCheckStamp(const psImage *image, // Image to check for threshold 32 const psImage *mask, // Mask to check for bad pixels 33 int x, int y, // Pixel coordinates 34 const poisConfig *config // Configuration 35 ) 36 { 37 if (x < config->footprint + config->xKernel || 38 y < config->footprint + config->yKernel || 39 x > config->xImage - config->footprint - config->xKernel || 40 y > config->yImage - config->footprint - config->yKernel || 41 image->data.F32[y][x] < config->threshold) { 42 psTrace("pois.checkStamp", 9, "Rejecting stamp at %d,%d (border/threshold)\n", x, y); 43 return false; 44 } 45 46 // Check the footprint 47 bool ok = true; // Is the footprint OK? 48 int footprint = config->footprint; // Footprint size 49 for (int v = y - footprint; v <= y + footprint && ok; v++) { 50 for (int u = x - footprint; u <= x + footprint && ok; u++) { 51 if (mask->data.U8[v][u] & 52 (POIS_MASK_BAD | POIS_MASK_NEAR_BAD | POIS_MASK_STAMP)) { 53 psTrace("pois.checkStamp", 9, "Rejecting stamp at %d,%d (bad footprint)\n", x, y); 54 ok = false; 55 } 56 } 57 } 58 59 return ok; 60 } 61
Note:
See TracChangeset
for help on using the changeset viewer.
