IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14824


Ignore:
Timestamp:
Sep 12, 2007, 10:21:41 AM (19 years ago)
Author:
Paul Price
Message:

The values in the variance map were about half of what they should
have been. Found that we need to normalise variance kernel so that
its sum is the square of the sum of the normal kernel --- simply
taking the square isn't enough. This corresponds to preserving the
relative scaling between the image and the weight map.

File:
1 edited

Legend:

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

    r14801 r14824  
    44 *  @author GLG, MHPCC
    55 *
    6  *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2007-09-10 20:10:05 $
     6 *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2007-09-12 20:21:41 $
    88 *
    99 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    8686
    8787    // Take the square of the normal kernel
     88    double sumNormal = 0.0, sumVariance = 0.0; // Sum of the normal and variance kernels
    8889    for (int v = yMin; v <= yMax; v++) {
    8990        for (int u = xMin; u <= xMax; u++) {
    90             kernel->kernel[v][u] = PS_SQR(normalKernel->kernel[v][u]);
    91         }
    92     }
     91            float value = normalKernel->kernel[v][u]; // Value of interest
     92            float value2 = PS_SQR(value); // Value squared
     93            sumNormal += value;
     94            sumVariance += value2;
     95            kernel->kernel[v][u] = value2;
     96        }
     97    }
     98
     99    // Normalise so that the sum of the variance kernel is the square of the sum of the normal kernel
     100    // This is required to keep the relative scaling between the image and the weight map
     101    psBinaryOp(kernel->image, kernel->image, "*",
     102               psScalarAlloc(PS_SQR(sumNormal) / sumVariance, PS_TYPE_F32));
    93103
    94104    return kernel;
Note: See TracChangeset for help on using the changeset viewer.