IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21290


Ignore:
Timestamp:
Feb 4, 2009, 11:43:11 AM (17 years ago)
Author:
Paul Price
Message:

Need to normalise the kernel, since that's what the interpolation does

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageInterpolate.c

    r21284 r21290  
    77 *  @author Paul Price, IfA
    88 *
    9  *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2009-02-04 20:46:40 $
     9 *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2009-02-04 21:43:11 $
    1111 *
    1212 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    978978    interpolationKernel(yKernel, yFrac, mode);
    979979
     980    // Need to normalise the kernel, since that's what the interpolation does
     981    double xSum = 0.0, ySum = 0.0;
     982    for (int i = 0; i < size; i++) {
     983        xSum += xKernel[i];
     984        ySum += yKernel[i];
     985    }
     986    for (int i = 0; i < size; i++) {
     987        xKernel[i] /= xSum;
     988        yKernel[i] /= ySum;
     989    }
     990
    980991    int min = -size/2, max = (size - 1) / 2; // Range for kernel
    981992    psKernel *kernel = psKernelAlloc(min, max, min, max); // Kernel to return
Note: See TracChangeset for help on using the changeset viewer.