IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 22, 2021, 9:45:09 AM (5 years ago)
Author:
eugene
Message:

tweak to the variance: should use nGood pixels in demoninator

File:
1 edited

Legend:

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

    r41921 r41924  
    400400    //     variance_combination = variance_individual / N
    401401    // which makes sense --- the standard deviation of the combination is reduced by a factor of sqrt(N).
     402    // NOTE: in 2012.07.13, the variance calculation was changed without justification to the variance
     403    // appropriate to a weighted mean, while the pixel mean was kept as the average unweighted by pixel variance
    402404
    403405    float sumValueWeight = 0.0;         // Sum of the value multiplied by the weight
     
    16861688            // }
    16871689            // variance on the mean (stdev / sqrt(N))^2
    1688             float varValue = varSum / (Npt*Npt);
     1690
     1691            // Note: since we are calculating the average of a subset of a sorted
     1692            // list of values, the denominator should not be the number of measurements
     1693            // in the calculation above (Npt): in the extreme case of a median, we would
     1694            // have a single value (Npt = 1), but the variance of a median is only ~1.4 x
     1695            // the variance of the average / sqrt(N).  We should use nGood (the total number
     1696            // of values in the sorted list), but the variance should be scaled by a factor
     1697            // which depends on the fraction of values included. 
     1698
     1699            // this coefficient varies between 1.4 (for pure median) and 1.05 for 68% range.
     1700
     1701            float varValue = varSum / (float) (nGood*nGood);
    16891702
    16901703            combined->image->data.F32[y][x] = mean;
Note: See TracChangeset for help on using the changeset viewer.