IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29219


Ignore:
Timestamp:
Sep 23, 2010, 8:28:16 AM (16 years ago)
Author:
eugene
Message:

change to fuzzy logic for suspect pixels (> 0.65 numGood with bit to set mask)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100823/psModules/src/imcombine/pmStack.c

    r29215 r29219  
    1919
    2020#include <stdio.h>
    21 #include <stdarg.h>
     21#include <string.h> // for memset
    2222#include <pslib.h>
    2323
     
    328328    *goodMask = 0xffff;
    329329
     330    int nGoodBits[16]; // accumulate the good pixel bits here for fuzzy logic
     331    psAssert (sizeof(psImageMaskType) == 2, "psImageMaskType is not the expected size");
     332    memset (nGoodBits, 0, 16*sizeof(int));
     333
    330334    // Extract the pixel and mask data
    331335    int numGood = 0;                    // Number of good pixels
     
    371375        pixelSuspects->data.U8[numGood] = mask->data.PS_TYPE_IMAGE_MASK_DATA[yIn][xIn] & suspectMaskBits ? true : false;
    372376
    373         *goodMask &= mask->data.PS_TYPE_IMAGE_MASK_DATA[yIn][xIn]; // save the mask bits still used
     377        // *goodMask &= mask->data.PS_TYPE_IMAGE_MASK_DATA[yIn][xIn]; // save the mask bits still used
     378        // check for set bits and increment counter as appropriate
     379        {
     380            psImageMaskType value = 0x0001;
     381            for (int nbit = 0; nbit < 16; nbit ++) {
     382                if (mask->data.PS_TYPE_IMAGE_MASK_DATA[yIn][xIn] & value) {
     383                    nGoodBits[nbit] ++;
     384                }
     385                value <<= 1;
     386            }
     387        }
    374388
    375389        psImage *image = data->readout->image; // Image of interest
     
    395409    pixelSuspects->n = numGood;
    396410    *num = numGood;
     411
     412    // set the mask bits if nGoodBits[i] > f*numGood
     413    {
     414        # define SUSPECT_FRACTION 0.65
     415        *goodMask = 0x0000;
     416        psImageMaskType value = 0x0001;
     417        for (int nbit = 0; nbit < 16; nbit ++) {
     418            if (nGoodBits[nbit] > SUSPECT_FRACTION*numGood) {
     419                *goodMask |= value;
     420            }
     421            value <<= 1;
     422        }
     423    }
    397424
    398425#ifdef TESTING
Note: See TracChangeset for help on using the changeset viewer.