IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 3, 2009, 4:55:27 PM (17 years ago)
Author:
Paul Price
Message:

Adding function to return an interpolation kernel. Intend to use this for calculating the covariance (pseudo-)matrix.

File:
1 edited

Legend:

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

    r21183 r21280  
    77 *  @author Paul Price, IfA
    88 *
    9  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2009-01-27 06:39:37 $
     9 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2009-02-04 02:55:27 $
    1111 *
    1212 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    866866
    867867
    868 psImageInterpolateStatus psImageInterpolate(double *imageValue, double *varianceValue, psImageMaskType *maskValue,
    869                                             float x, float y, const psImageInterpolation *interp)
     868psImageInterpolateStatus psImageInterpolate(double *imageValue, double *varianceValue,
     869                                            psImageMaskType *maskValue, float x, float y,
     870                                            const psImageInterpolation *interp)
    870871{
    871872    PS_ASSERT_PTR_NON_NULL(imageValue, PS_INTERPOLATE_STATUS_ERROR);
     
    963964
    964965
     966psKernel *psImageInterpolationKernel(float x, float y, psImageInterpolateMode mode)
     967{
     968    int size = kernelSizes[mode];       // Size of kernel
     969
     970    // Kernel basics
     971    INTERPOLATE_SETUP(x, y);
     972    xExact = yExact = false;
     973
     974    psF32 xKernel[size], yKernel[size]; // Interpolation kernels
     975    interpolationKernel(xKernel, xFrac, mode);
     976    interpolationKernel(yKernel, yFrac, mode);
     977
     978    int min = -size/2, max = (size - 1) / 2; // Range for kernel
     979    psKernel *kernel = psKernelAlloc(min, max, min, max); // Kernel to return
     980
     981    for (int y = 0; y < size; y++) {
     982        for (int x = 0; x < size; x++) {
     983            kernel->kernel[y][x] = yKernel[y] * xKernel[x];
     984        }
     985    }
     986
     987    return kernel;
     988}
     989
     990
    965991psImageInterpolateMode psImageInterpolateModeFromString(const char *name)
    966992{
Note: See TracChangeset for help on using the changeset viewer.