Changeset 29390
- Timestamp:
- Oct 13, 2010, 12:38:33 PM (16 years ago)
- Location:
- trunk/psModules/src/extras
- Files:
-
- 2 edited
-
pmCensor.c (modified) (7 diffs)
-
pmCensor.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/extras/pmCensor.c
r29389 r29390 3 3 4 4 bool 5 pmCensorGetMask (pmConfig *config, psU32 *pMaskMask)5 pmCensorGetMasks(pmConfig *config, psU32 *pMaskCensor, psU32 *pMaskStreak) 6 6 { 7 7 bool status; … … 12 12 } 13 13 14 // first look for the value in the recipes15 psU32 maskMask = psMetadataLookupU32(&status, config->camera, "MASK.NO.CENSOR");16 if (status) {17 // All done18 *pMaskMask = ~maskMask;19 return true;20 }21 // Not defined. Now we must compute it.22 14 23 15 // Older sets of mask values had SPIKE and STARCORE with the same value as STREAK … … 28 20 return false; 29 21 } 22 *pMaskStreak = streak; 23 24 // first look for the value in the recipes 25 psU32 maskNoCensor = psMetadataLookupU32(&status, config->camera, "MASK.NO.CENSOR"); 26 if (status) { 27 // All done 28 *pMaskCensor = ~maskNoCensor; 29 return true; 30 } 31 32 // Not defined. So we must compute it. 30 33 31 34 // preserve pixels that are only CONV.POOR … … 62 65 // That was true in older 8 bit mask configurations. 63 66 64 *pMask Mask= ~(convPoor | suspect | starcore | spike) | streak;67 *pMaskCensor = ~(convPoor | suspect | starcore | spike) | streak; 65 68 66 69 return true; … … 71 74 *pNumCensored = 0; 72 75 73 psU32 maskMask; 74 if (!pmCensorGetMask(config, &maskMask)) { 76 psU32 censorMask; 77 psU32 streakMask; 78 if (!pmCensorGetMasks(config, &censorMask, &streakMask)) { 75 79 psError(PS_ERR_UNKNOWN, false, "failed to lookup set of mask bits to censor.\n"); 76 80 return false; 77 81 } 78 82 79 if (~ maskMask == 0) {83 if (~censorMask == 0) { 80 84 // censoring masked pixels is not required 81 85 return true; … … 84 88 double exciseValue; 85 89 if (image->type.type == PS_TYPE_U16) { 90 exciseValue = 0x7fff; 91 } else if (image->type.type == PS_TYPE_U16) { 86 92 exciseValue = 0xffff; 87 93 } else if (image->type.type == PS_TYPE_F32) { … … 96 102 for (int x=0; x<image->numCols; x++) { 97 103 psU16 maskVal = psImageGet(mask, x, y); 98 if (maskVal & maskMask) {104 if (maskVal & censorMask) { 99 105 (*pNumCensored)++; 100 106 psImageSet(image, x, y, exciseValue); -
trunk/psModules/src/extras/pmCensor.h
r29389 r29390 4 4 #include <pmConfig.h> 5 5 6 bool pmCensorGetMask(pmConfig *config, psU32 *pMask Mask);6 bool pmCensorGetMask(pmConfig *config, psU32 *pMaskCensor, psU32 *pMaskStreak); 7 7 bool pmCensorMasked(pmConfig *config, psImage *image, psImage *mask, psImage *variance, long *pNumCensored); 8 8
Note:
See TracChangeset
for help on using the changeset viewer.
