IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 12, 2008, 9:18:33 PM (17 years ago)
Author:
Paul Price
Message:

Apply threshold to stamps from list. Threshold is now specified as standard deviations above the background, instead of an absolute value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtractionMatch.c

    r20568 r20714  
    213213    int numCols = ro1->image->numCols, numRows = ro1->image->numRows; // Image dimensions
    214214
     215    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator
     216
     217    {
     218        psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); // Statistics for backgroun
     219        if (!psImageBackground(bg, NULL, ro1->image, ro1->mask, maskVal, rng)) {
     220            psError(PS_ERR_UNKNOWN, false, "Unable to measure background statistics.");
     221            psFree(bg);
     222            psFree(rng);
     223            goto MATCH_ERROR;
     224        }
     225        threshold = bg->robustMedian + threshold * bg->robustStdev;
     226        psFree(bg);
     227        psFree(rng);
     228    }
     229
    215230    memCheck("start");
    216231
     
    270285                // Get backgrounds
    271286                psStats *bgStats = psStatsAlloc(BG_STAT); // Statistics for background
    272                 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator
    273287                psVector *buffer = NULL;// Buffer for stats
    274288                if (!psImageBackground(bgStats, &buffer, ro1->image, ro1->mask, maskVal, rng)) {
    275289                    psError(PS_ERR_UNKNOWN, false, "Unable to measure background of image 1.");
    276290                    psFree(bgStats);
    277                     psFree(rng);
    278291                    psFree(buffer);
    279292                    goto MATCH_ERROR;
     
    283296                    psError(PS_ERR_UNKNOWN, false, "Unable to measure background of image 2.");
    284297                    psFree(bgStats);
    285                     psFree(rng);
    286298                    psFree(buffer);
    287299                    goto MATCH_ERROR;
     
    289301                float bg2 = psStatsGetValue(bgStats, BG_STAT); // Background for image 2
    290302                psFree(bgStats);
    291                 psFree(rng);
    292303                psFree(buffer);
    293304
     
    423434        }
    424435    }
     436    psFree(rng);
     437    rng = NULL;
    425438    psFree(region);
    426439    region = NULL;
     
    473486    psFree(stamps);
    474487    psFree(weight);
     488    psFree(rng);
    475489    return false;
    476490}
Note: See TracChangeset for help on using the changeset viewer.