IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 17, 2006, 5:11:30 PM (20 years ago)
Author:
Paul Price
Message:

Updating to work with pslib rel10 --- needed to fix polynomial allocation and image subregions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pois/src/poisExtractKernel.c

    r5717 r6452  
    66/* Create a kernel image from the solution vector */
    77psImage *poisExtractKernel(const psVector *solution, // Vector containing the kernel elements
    8                            const psArray *kernelParams, // The kernel parameters
    9                            float x,     // The relative (-1 to 1) x position for which to get the kernel
    10                            float y,     // The relative (-1 to 1) y position for which to get the kernel
    11                            const poisConfig *config // Configuration
     8                           const psArray *kernelParams, // The kernel parameters
     9                           float x,     // The relative (-1 to 1) x position for which to get the kernel
     10                           float y,     // The relative (-1 to 1) y position for which to get the kernel
     11                           const poisConfig *config // Configuration
    1212    )
    1313{
     
    1818    assert(y >= -1.0 && y <= 1.0);
    1919
    20     int xKernel = config->xKernel;      // Half-size of kernel in x
    21     int yKernel = config->yKernel;      // Half-size of kernel in y
    22     float kernelSum = 0.0;              // Sum of the kernel
     20    int xKernel = config->xKernel;      // Half-size of kernel in x
     21    int yKernel = config->yKernel;      // Half-size of kernel in y
     22    float kernelSum = 0.0;              // Sum of the kernel
    2323
    2424    /* Allocate the image */
    2525    psImage *image = psImageAlloc(2*xKernel + 1, 2*yKernel + 1, PS_TYPE_F32); // The kernel image
    2626    for (int j = 0; j < (2*yKernel + 1); j++) {
    27         for (int i = 0; i < (2*xKernel + 1); i++) {
    28             image->data.F32[j][i] = 0.0;
    29         }
     27        for (int i = 0; i < (2*xKernel + 1); i++) {
     28            image->data.F32[j][i] = 0.0;
     29        }
    3030    }
    3131
    32     psPolynomial2D *poly = psPolynomial2DAlloc(config->spatialOrder + 1, config->spatialOrder + 1,
    33                                                PS_POLYNOMIAL_ORD); // Polynomial for evaluation
     32    psPolynomial2D *poly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, config->spatialOrder + 1,
     33                                               config->spatialOrder + 1); // Polynomial for evaluation
    3434    for (int j = 0; j < config->spatialOrder + 1; j++) {
    35         for (int i = 0; i < config->spatialOrder + 1; i++) {
    36             poly->coeff[j][i] = 1.0;
    37             poly->mask[j][i] = 1;       // Mask all coefficients; unmask to evaluate
    38         }
     35        for (int i = 0; i < config->spatialOrder + 1; i++) {
     36            poly->coeff[j][i] = 1.0;
     37            poly->mask[j][i] = 1;       // Mask all coefficients; unmask to evaluate
     38        }
    3939    }
    4040
     
    4242    /* Iterate over the kernel parameters */
    4343    for (int k = 0; k < kernelParams->n; k++) {
    44         poisKernelBasis *kernel = kernelParams->data[k]; // The kernel basis function
     44        poisKernelBasis *kernel = kernelParams->data[k]; // The kernel basis function
    4545
    46         int u = kernel->u;
    47         int v = kernel->v;
    48         int xOrder = kernel->xOrder;
    49         int yOrder = kernel->yOrder;
     46        int u = kernel->u;
     47        int v = kernel->v;
     48        int xOrder = kernel->xOrder;
     49        int yOrder = kernel->yOrder;
    5050
    51         // Evaluate polynomial
    52         poly->mask[xOrder][yOrder] = 0;
    53         double evaluation = solution->data.F64[k] * psPolynomial2DEval(poly, x, y);
    54         poly->mask[xOrder][yOrder] = 1;
     51        // Evaluate polynomial
     52        poly->mask[xOrder][yOrder] = 0;
     53        double evaluation = solution->data.F64[k] * psPolynomial2DEval(poly, x, y);
     54        poly->mask[xOrder][yOrder] = 1;
    5555
    56         image->data.F32[v + yKernel][u + xKernel] += (float)evaluation;
    57         kernelSum += (float)evaluation;
     56        image->data.F32[v + yKernel][u + xKernel] += (float)evaluation;
     57        kernelSum += (float)evaluation;
    5858    }
    5959
Note: See TracChangeset for help on using the changeset viewer.