Changeset 15953 for trunk/ppMerge/src/ppMergeMaskGrow.c
- Timestamp:
- Dec 28, 2007, 12:52:30 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppMerge/src/ppMergeMaskGrow.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppMerge/src/ppMergeMaskGrow.c
r15937 r15953 18 18 // Generate a mask 19 19 bool ppMergeMaskGrow(ppMergeData *data, // Data 20 ppMergeOptions *options, // Options21 pmConfig *config // Configuration20 ppMergeOptions *options, // Options 21 pmConfig *config // Configuration 22 22 ) 23 23 { … … 35 35 while ((roOut = pmFPAviewNextReadout(view, fpaOut, 1))) { 36 36 37 ppMergeMaskGrowReadout(roOut, options->combine->maskVal); 38 37 // do this N iterations (XXX add to options) 38 ppMergeMaskGrowReadout(roOut, options->combine->maskVal, options->growPixels); 39 ppMergeMaskGrowReadout(roOut, options->combine->maskVal, options->growPixels); 39 40 } 40 41 } … … 46 47 } 47 48 48 # define NGROW 2 49 50 bool ppMergeMaskGrowReadout (pmReadout *readout, psMaskType maskVal) { 49 bool ppMergeMaskGrowReadout (pmReadout *readout, psMaskType maskVal, int nPixels) { 51 50 52 51 if (!readout->mask) return true; … … 62 61 for (int iy = 0; iy < Ny; iy++) { 63 62 for (int ix = 0; ix < Nx; ix++) { 64 65 if (oldMask->data.U8[iy][ix] && maskVal) {66 67 for (int jy = -NGROW; jy <= +NGROW; jy++) {68 int ny = iy + jy;69 if (ny < 0) continue;70 if ( ny >= Ny) continue;71 for (int jx = -NGROW; jx <= +NGROW; jx++) {72 int nx = ix + jx;73 if (nx < 0) continue;74 if (nx >= Nx) continue;75 n ewMask->data.U8[ny][nx] |= oldMask->data.U8[iy][ix];63 int nSum = 0; 64 for (int jy = -1; jy <= +1; jy++) { 65 int ny = iy + jy; 66 if (ny < 0) continue; 67 if (ny >= Ny) continue; 68 for (int jx = -1; jx <= +1; jx++) { 69 if (!jx && !jy) continue; 70 int nx = ix + jx; 71 if (nx < 0) continue; 72 if (nx >= Nx) continue; 73 if (oldMask->data.U8[ny][nx] & maskVal) { 74 nSum ++; 76 75 } 77 76 } 78 77 } 78 if (nSum >= nPixels) { 79 newMask->data.U8[iy][ix] = maskVal; 80 } else { 81 newMask->data.U8[iy][ix] = oldMask->data.U8[iy][ix]; 82 } 79 83 } 80 84 } 81 82 85 psFree (readout->mask); 83 86 readout->mask = newMask;
Note:
See TracChangeset
for help on using the changeset viewer.
