IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 20, 2009, 2:48:42 PM (17 years ago)
Author:
Paul Price
Message:

Implement stamp thresholds on both images. This is to avoid transients being selected as stamps.

File:
1 edited

Legend:

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

    r23851 r23937  
    6464                      psImage *variance,  // Variance map
    6565                      const psRegion *region, // Region of interest, or NULL
    66                       float threshold,  // Threshold for stamp finding
     66                      float thresh1,  // Threshold for stamp finding on readout 1
     67                      float thresh2,  // Threshold for stamp finding on readout 2
    6768                      float stampSpacing, // Spacing between stamps
    6869                      int size,         // Kernel half-size
     
    7273{
    7374    psTrace("psModules.imcombine", 3, "Finding stamps...\n");
    74     *stamps = pmSubtractionStampsFind(*stamps, ro1->image, subMask, region, threshold, size, footprint,
    75                                       stampSpacing, mode);
     75
     76    psImage *image1 = ro1 ? ro1->image : NULL, *image2 = ro2 ? ro2->image : NULL; // Images of interest
     77
     78    *stamps = pmSubtractionStampsFind(*stamps, image1, image2, subMask, region, thresh1, thresh2,
     79                                      size, footprint, stampSpacing, mode);
    7680    if (!*stamps) {
    7781        psError(psErrorCodeLast(), false, "Unable to find stamps.");
     
    392396    }
    393397
     398    float stampThresh1 = NAN, stampThresh2 = NAN; // Stamp thresholds for images
    394399    {
    395400        psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); // Statistics for backgroun
    396         if (!psImageBackground(bg, NULL, ro1->image, ro1->mask, maskVal, rng)) {
    397             psError(PS_ERR_UNKNOWN, false, "Unable to measure background statistics.");
    398             psFree(bg);
    399             psFree(rng);
    400             goto MATCH_ERROR;
    401         }
    402         threshold = bg->robustMedian + threshold * bg->robustStdev;
     401        if (ro1) {
     402            if (!psImageBackground(bg, NULL, ro1->image, ro1->mask, maskVal, rng)) {
     403                psError(PS_ERR_UNKNOWN, false, "Unable to measure background statistics.");
     404                psFree(bg);
     405                psFree(rng);
     406                goto MATCH_ERROR;
     407            }
     408            stampThresh1 = bg->robustMedian + threshold * bg->robustStdev;
     409        }
     410        if (ro2) {
     411            if (!psImageBackground(bg, NULL, ro2->image, ro2->mask, maskVal, rng)) {
     412                psError(PS_ERR_UNKNOWN, false, "Unable to measure background statistics.");
     413                psFree(bg);
     414                psFree(rng);
     415                goto MATCH_ERROR;
     416            }
     417            stampThresh2 = bg->robustMedian + threshold * bg->robustStdev;
     418        }
    403419        psFree(bg);
    404420    }
     
    428444            // We get the stamps here; we will also attempt to get stamps at the first iteration, but it
    429445            // doesn't matter.
    430             if (!getStamps(&stamps, ro1, ro2, subMask, variance, NULL, threshold, stampSpacing,
    431                            size, footprint, subMode)) {
     446            if (!getStamps(&stamps, ro1, ro2, subMask, variance, NULL, stampThresh1, stampThresh2,
     447                           stampSpacing, size, footprint, subMode)) {
    432448                goto MATCH_ERROR;
    433449            }
     
    490506                psLogMsg("psModules.imcombine", PS_LOG_INFO, "Iteration %d.", k);
    491507
    492                 if (!getStamps(&stamps, ro1, ro2, subMask, variance, region, threshold, stampSpacing,
    493                                size, footprint, subMode)) {
     508                if (!getStamps(&stamps, ro1, ro2, subMask, variance, region, stampThresh1, stampThresh2,
     509                               stampSpacing, size, footprint, subMode)) {
    494510                    goto MATCH_ERROR;
    495511                }
Note: See TracChangeset for help on using the changeset viewer.