Changeset 4571
- Timestamp:
- Jul 15, 2005, 3:45:50 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/pois/src/poisReadStamps.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pois/src/poisReadStamps.c
r4569 r4571 3 3 #include "pois.h" 4 4 5 #define MAXLINE 128 // Maximum length of a line in the stamps file 6 7 5 8 psArray *poisReadStamps(psArray *stamps,// Stamps 6 9 FILE **stampFP, // File pointer for stamps file 10 const psImage *image, // Image for which to find stamps 11 const psImage *mask, // Mask image 7 12 const poisConfig *config // Configuration 8 13 ) … … 28 33 int xPixel, yPixel; // Integer position 29 34 int result = 0; // Result of fscanf 35 bool badPixels = false; // Result of check on stamp footprint 36 char line[MAXLINE]; // The line from the stamps file 37 char *lineBack; // The line back from fgets 30 38 do { 31 result = fscanf(fp, "%f %f", &x, &y); 39 lineBack = fgets(line, MAXLINE, fp); 40 result = sscanf(line, "%f %f", &x, &y); 41 32 42 // Add 0.5 for rounding, and subtract 1.0 for unit-offset to zero-offset 33 43 xPixel = (int)(x - 0.5); 34 44 yPixel = (int)(y - 0.5); 35 } while ((xPixel < config->footprint + config->xKernel || 36 yPixel < config->footprint + config->yKernel || 37 xPixel > config->xImage - config->footprint - config->xKernel || 38 yPixel > config->yImage - config->footprint - config->yKernel) && 39 result == 2); 40 if (result == 2) { 45 } while (! poisCheckStamp(image, mask, xPixel, yPixel, config) && result == 2 && lineBack); 46 if (result == 2 && lineBack) { 41 47 stamp->x = xPixel; 42 48 stamp->y = yPixel; … … 44 50 psTrace("pois.readStamps", 7, "Stamp %d: %d,%d\n", i, stamp->x, stamp->y); 45 51 } else { 52 // We've run out of stamps in the file --- probably got EOF 46 53 stamp->status = POIS_STAMP_BAD; 47 54 } 48 55 } else { 56 // Stamp file isn't open! 49 57 stamp->status = POIS_STAMP_BAD; 50 58 }
Note:
See TracChangeset
for help on using the changeset viewer.
