Changeset 34800 for trunk/psModules/src/camera/pmFPABin.c
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
trunk/psModules
- Property svn:mergeinfo changed
/branches/czw_branch/20120906/psModules (added) merged: 34442,34516,34623,34625-34626,34667,34772
- Property svn:mergeinfo changed
-
trunk/psModules/src/camera/pmFPABin.c
r24906 r34800 43 43 } 44 44 45 int Nbits = (int) (ceil(log(maskVal)/log(2)) + 1); 46 int *bitcounter = malloc(sizeof(int) * Nbits); 47 int pxlcount; 48 45 49 int xLast = numColsIn - 1, yLast = numRowsIn - 1; // Last index 46 50 int yStart = psImageBinningGetFineY(binning, 0); // Starting input y for binning … … 55 59 float sum = 0.0; // Sum of pixels 56 60 int numPix = 0; // Number of pixels 61 62 for (int j = 0; j < Nbits; j++) { // Reset bit counter 63 bitcounter[j] = 0; 64 } 65 pxlcount = 0; 66 57 67 for (int y = yStart; y < yStop; y++) { 58 68 for (int x = xStart; x < xStop; x++) { 69 if (inMask && (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] != 0)) { 70 for (int j = 0; j < Nbits; j++) { 71 psImageMaskType M = (psImageMaskType) pow(2,j); 72 if (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & M) { 73 bitcounter[j]++; 74 } 75 } 76 } 77 59 78 if (inMask && (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal)) { 60 79 continue; … … 65 84 sum += inImage->data.F32[y][x]; 66 85 numPix++; 86 87 67 88 } 68 89 } 69 90 91 70 92 // Values to set 71 93 float imageValue; … … 79 101 } 80 102 outImage->data.F32[yOut][xOut] = imageValue; 81 outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = maskValue; 103 // outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = maskValue; 104 outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = 0; 105 for (int j = 0; j < Nbits; j++) { 106 if (bitcounter[j] > 0.5 * pxlcount) { 107 outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] |= (int) pow(2,j); 108 } 109 } 82 110 xStart = xStop; 83 111 }
Note:
See TracChangeset
for help on using the changeset viewer.
