IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 9, 2008, 4:43:01 PM (18 years ago)
Author:
Paul Price
Message:

Gene has determined that what I had before --- normalising by the sum
of kernel squares for the variance --- is the correct thing to do, so
I'm restoring what I had before. Here's Gene's explanation:

since the errors in the output image are correlated by the smoothing
kernel, the output variance image actually should not change
normalization under the smoothing. thus, you should in fact the
normalizing to have the sum(psf2) = 1.0.
Note that in the output smoothed image, the per-pixel variance [sum of
(v[i][j] - <v>)
2] will decrease as you smooth, but the variance of
apertures comparable to your smoothing scale will not be decreased.
thus, the output weight image you generate is appropriate for
measuring extended parameters, but not per-pixel stats. If you are
making the assumption that the per-pixel variance should be consistent
with the mean of the variance images, you will have an error.

File:
1 edited

Legend:

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

    r17811 r18043  
    44 *  @author GLG, MHPCC
    55 *
    6  *  @version $Revision: 1.92 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2008-05-24 23:24:15 $
     6 *  @version $Revision: 1.93 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2008-06-10 02:43:01 $
    88 *
    99 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    5050
    5151    // Take the square of the normal kernel
     52    double sumNormal = 0.0, sumVariance = 0.0; // Sum of the normal and variance kernels
    5253    for (int v = yMin; v <= yMax; v++) {
    5354        for (int u = xMin; u <= xMax; u++) {
    54             out->kernel[v][u] = PS_SQR(normalKernel->kernel[v][u]);
    55         }
    56     }
     55            float value = normalKernel->kernel[v][u]; // Value of interest
     56            float value2 = PS_SQR(value); // Value squared
     57            sumNormal += value;
     58            sumVariance += value2;
     59            out->kernel[v][u] = value2;
     60        }
     61    }
     62
     63    // Normalise so that the sum of the variance kernel is the square of the sum of the normal kernel
     64    // This is required to keep the relative scaling between the image and the weight map
     65    psBinaryOp(out->image, out->image, "*", psScalarAlloc(PS_SQR(sumNormal) / sumVariance, PS_TYPE_F32));
    5766
    5867    return out;
Note: See TracChangeset for help on using the changeset viewer.