IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41957


Ignore:
Timestamp:
Dec 3, 2021, 8:02:04 AM (5 years ago)
Author:
eugene
Message:

calculate alternate variance value if number of measurements > 8

File:
1 edited

Legend:

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

    r41954 r41957  
    17151715            if ((Npt < 1) || (nGood < MIN_GOOD_PERCENTILE)) ESCAPE;
    17161716
    1717             // XXX note that this does not respect the clipping above
    1718             // set the given (suspect) mask bit if nGoodBits[i] > f*nGood
    1719             // in other words if more than 65% of the good inputs had one of
    1720             // these bits set, then we should set that bit in the output mask
     1717            // Set the given (suspect) mask bit if nGoodBits[i] > f*nGood in other words
     1718            // if more than 65% of the good inputs had one of these bits set, then we
     1719            // should set that bit in the output mask.  Note that this analysis counts the
     1720            // mask bits of pixels rejected by the clipping above.
    17211721            psImageMaskType value = 0x0001;
    17221722            psImageMaskType outputMask = 0x0000;
     
    17351735            }
    17361736            float mean = sum / (float) Npt;
     1737            float varValue = varSum / (float) (nGoodClip*nGoodClip);
    17371738
    17381739            // alternative: calculate the stdev of the pixel values
     
    17421743            // }
    17431744            // variance on the mean (stdev / sqrt(N))^2
     1745
     1746            // the reported variance values can be extremely high / wrong.
     1747            // if we have enough measurements, let's just use the interquartile range
     1748            // of the data to estimate the per-pixel variance.  NOTE: this is not valid
     1749            // if the inputs have been significantly smoothed.  In that case we need
     1750            // to include the covariance explicitly.  But this algorithm should be used
     1751            // without convolution.
     1752            // XXX How do we choose the cutoff here?
     1753            if (nGoodClip >= 9) {
     1754              // Measure interquartile range
     1755              int P25 = 0.25*nGoodClip + Nlo;
     1756              int P75 = 0.75*nGoodClip + Nlo;
     1757              float rawSigma = 0.74*(pixelData->data.F32[P75] - pixelData->data.F32[P25]);
     1758              varValue = PS_SQR(rawSigma) / (float) nGoodClip; // sigma_mean = sigma_meas / sqrt(Nmeas) -> var_mean = var_meas / Nmeas
     1759            }
    17441760
    17451761            // Note: since we are calculating the average of a subset of a sorted
     
    17521768
    17531769            // this coefficient varies between 1.4 (for pure median) and 1.05 for 68% range.
    1754 
    1755             float varValue = varSum / (float) (nGoodClip*nGoodClip);
    17561770
    17571771            combined->image->data.F32[y][x] = mean;
Note: See TracChangeset for help on using the changeset viewer.