IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 13, 2009, 7:54:28 PM (17 years ago)
Author:
Paul Price
Message:

Attempting to fix dual convolution. Starting off by consolidating and making code plain to do forwards convolution. Adding some small optimisations: it's slightly quicker to generate the solvedKernel using the pre-computed full image kernel, but for convolving stamps, faster to use the separate x and y kernels.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap/psModules/src/imcombine/pmSubtractionKernels.c

    r25120 r25833  
    140140        for (int uOrder = 0; uOrder <= orders->data.S32[i]; uOrder++) {
    141141            for (int vOrder = 0; vOrder <= orders->data.S32[i] - uOrder; vOrder++, index++) {
    142                 psArray *preCalc = psArrayAlloc(2); // Array to hold precalculated values
     142                psArray *preCalc = psArrayAlloc(3); // Array to hold precalculated values
    143143                psVector *xKernel = preCalc->data[0] = subtractionKernelISIS(sigma, uOrder, size); // x Kernel
    144144                psVector *yKernel = preCalc->data[1] = subtractionKernelISIS(sigma, vOrder, size); // y Kernel
     145                psKernel *kernel = preCalc->data[2] = psKernelAlloc(-size, size, -size, size);      // Kernel
    145146
    146147                // Calculate moments
     
    149150                    for (int u = -size, x = 0; u <= size; u++, x++) {
    150151                        double value = xKernel->data.F32[x] * yKernel->data.F32[y]; // Value of kernel
     152                        kernel->kernel[v][u] = value;
    151153                        moment += value * (PS_SQR(u) + PS_SQR(v));
    152154                    }
     
    164166                    psBinaryOp(xKernel, xKernel, "*", psScalarAlloc(sum, PS_TYPE_F32));
    165167                    psBinaryOp(yKernel, yKernel, "*", psScalarAlloc(sum, PS_TYPE_F32));
     168                    psBinaryOp(kernel->image, kernel->image, "*", psScalarAlloc(PS_SQR(sum), PS_TYPE_F32));
     169                    kernel->kernel[0][0] -= 1.0;
    166170                    moment *= PS_SQR(sum);
    167171                }
Note: See TracChangeset for help on using the changeset viewer.