IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 29, 2009, 5:21:31 PM (17 years ago)
Author:
Paul Price
Message:

Deal with mask when binning.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPABin.c

    r21183 r24003  
    2828    int numColsOut = binning->nXruff, numRowsOut = binning->nYruff; // Size of output image
    2929
    30     // Output image
    31     psImage *outImage;
     30
     31    psImage *outImage;                  // Output image
    3232    if (out->image && out->image->numCols >= numColsOut && out->image->numRows >= numRowsOut) {
    3333        outImage = out->image;
    3434    } else {
    3535        outImage = out->image = psImageRecycle(out->image,  numColsOut, numRowsOut, PS_TYPE_F32);
     36    }
     37
     38    psImage *outMask;                   // Output mask
     39    if (out->mask && out->mask->numCols >= numColsOut && out->mask->numRows >= numRowsOut) {
     40        outMask = out->mask;
     41    } else {
     42        outMask = out->mask = psImageRecycle(out->mask,  numColsOut, numRowsOut, PS_TYPE_IMAGE_MASK);
    3643    }
    3744
     
    5865            }
    5966
    60             outImage->data.F32[yOut][xOut] = numPix > 0 ? sum / numPix : NAN;
     67            float imageValue, maskValue;// Values to set
     68            if (numPix > 0) {
     69                imageValue = sum / numPix;
     70                maskValue = 0;
     71            } else {
     72                imageValue = NAN;
     73                maskValue = maskVal;
     74            }
     75            outImage->data.F32[yOut][xOut] = imageValue;
     76            outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = maskValue;
    6177            xStart = xStop;
    6278        }
Note: See TracChangeset for help on using the changeset viewer.