IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25841


Ignore:
Timestamp:
Oct 14, 2009, 12:50:17 PM (17 years ago)
Author:
Paul Price
Message:

Working on dual convolution.... not happy yet.

Location:
branches/pap/psModules/src/imcombine
Files:
4 edited

Legend:

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

    r25834 r25841  
    7070                              const pmSubtractionKernels *kernels, // Kernel basis functions
    7171                              const psImage *polyValues, // Spatial polynomial values
     72                              bool normalise,            // Add normalisation?
    7273                              bool wantDual // Want the dual (second) kernel?
    7374                              )
     
    178179    }
    179180
    180     // Put in the normalisation component
    181     kernel->kernel[0][0] += (wantDual ? 1.0 : p_pmSubtractionSolutionNorm(kernels));
     181    if (normalise) {
     182        // Put in the normalisation component
     183        kernel->kernel[0][0] += (wantDual ? 1.0 : p_pmSubtractionSolutionNorm(kernels));
     184    }
    182185
    183186    return kernel;
     
    349352    )
    350353{
    351     *kernelImage = solvedKernel(*kernelImage, kernels, polyValues, wantDual);
     354    *kernelImage = solvedKernel(*kernelImage, kernels, polyValues, true, wantDual);
    352355    if (variance || subMask) {
    353356        *kernelVariance = varianceKernel(*kernelVariance, *kernelImage);
     
    466469    psKernel *kernel;                   // Kernel to use
    467470    if (!preKernel) {
    468         kernel = solvedKernel(NULL, kernels, polyValues, wantDual);
     471        kernel = solvedKernel(NULL, kernels, polyValues, true, wantDual);
    469472    } else {
    470473        kernel = psMemIncrRefCounter(preKernel);
     
    916919
    917920    psImage *polyValues = p_pmSubtractionPolynomial(NULL, kernels->spatialOrder, x, y); // Solved polynomial
    918     psKernel *kernel = solvedKernel(NULL, kernels, polyValues, wantDual); // The appropriate kernel
     921    psKernel *kernel = solvedKernel(NULL, kernels, polyValues, true, wantDual); // The appropriate kernel
    919922    psFree(polyValues);
    920923
     
    947950    psImage *polyValues = p_pmSubtractionPolynomial(NULL, kernels->spatialOrder, x, y);
    948951
    949     psKernel *kernel = solvedKernel(NULL, kernels, polyValues, wantDual); // The appropriate kernel
     952    psKernel *kernel = solvedKernel(NULL, kernels, polyValues, true, wantDual); // The appropriate kernel
    950953    psFree(polyValues);
    951954
     
    977980    int num = wantDual ? solution->n - 1 : solution->n; // Number of kernel basis functions
    978981
    979     psArray *images = psArrayAlloc(num); // Images of each kernel to return
     982    psImage *polyValues = p_pmSubtractionPolynomial(NULL, kernels->spatialOrder, x, y); // Solved polynomial
     983    psArray *images = psArrayAlloc(num + 1); // Images of each kernel to return
     984
     985    // The whole kernel
     986    {
     987        psKernel *kernel = solvedKernel(NULL, kernels, polyValues, true, wantDual); // The appropriate kernel
     988        images->data[0] = psMemIncrRefCounter(kernel->image);
     989        psFree(kernel);
     990    }
     991
     992    // The parts
    980993    psVectorInit(solution, 0.0);
    981 
    982994    for (int i = 0; i < num; i++) {
    983995        solution->data.F64[i] = backup->data.F64[i];
    984         images->data[i] = pmSubtractionKernelImage(kernels, x, y, wantDual);
     996        psKernel *kernel = solvedKernel(NULL, kernels, polyValues, false, wantDual); // The appropriate kernel
     997#if 0
     998        int size = kernels->size;
     999        double sum = 0.0;
     1000        for (int v = -size; v <= size; v++) {
     1001            for (int u = -size; u <= size; u++) {
     1002                sum += kernel->kernel[v][u];
     1003            }
     1004        }
     1005        fprintf(stderr, "Kernel %d: %lf\n", i, sum);
     1006#endif
     1007        images->data[i + 1] = psMemIncrRefCounter(kernel->image);
     1008        psFree(kernel);
    9851009        solution->data.F64[i] = 0.0;
    9861010    }
     1011    psFree(polyValues);
    9871012    psVectorCopy(solution, backup, PS_TYPE_F64);
    9881013    psFree(backup);
  • branches/pap/psModules/src/imcombine/pmSubtractionAnalysis.c

    r25834 r25841  
    1616#define KERNEL_MOSAIC 2                 // Half-number of kernel instances in the mosaic image
    1717
    18 //#define TESTING
     18#define TESTING
    1919
    2020bool pmSubtractionAnalysis(psMetadata *analysis, psMetadata *header,
  • branches/pap/psModules/src/imcombine/pmSubtractionEquation.c

    r25834 r25841  
    13881388
    13891389
    1390 #if 0
     1390#if 1
    13911391        for (int i = 0; i < numParams; i++) {
    13921392            double aVal1 = 0.0, bVal1 = 0.0;
  • branches/pap/psModules/src/imcombine/pmSubtractionKernels.c

    r25833 r25841  
    170170                    moment *= PS_SQR(sum);
    171171                }
     172
     173
     174#if 0
     175                double sum = 0.0;   // Sum of kernel component
     176                for (int v = -size; v <= size; v++) {
     177                    for (int u = -size; u <= size; u++) {
     178                        sum += kernel->kernel[v][u];
     179                    }
     180                }
     181                fprintf(stderr, "%d sum: %lf\n", index, sum);
     182#endif
    172183
    173184                kernels->widths->data.F32[index] = fwhms->data.F32[i];
Note: See TracChangeset for help on using the changeset viewer.